• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SAMLVersion类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.opensaml.common.SAMLVersion的典型用法代码示例。如果您正苦于以下问题:Java SAMLVersion类的具体用法?Java SAMLVersion怎么用?Java SAMLVersion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SAMLVersion类属于org.opensaml.common包,在下文中一共展示了SAMLVersion类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: processAttribute

import org.opensaml.common.SAMLVersion; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {

    Assertion assertion = (Assertion) samlObject;

    if (Assertion.ID_ATTRIB_NAME.equals(attribute.getLocalName())) {
        assertion.setID(attribute.getValue());
    } else if (Assertion.ISSUER_ATTRIB_NAME.equals(attribute.getLocalName())) {
        assertion.setIssuer(attribute.getValue());
    } else if (Assertion.ISSUEINSTANT_ATTRIB_NAME.equals(attribute.getLocalName())
            && !DatatypeHelper.isEmpty(attribute.getValue())) {
        assertion.setIssueInstant(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
    } else if (Assertion.MINORVERSION_ATTRIB_NAME.equals(attribute.getLocalName())) {
        if (attribute.getValue().equals("0")) {
            assertion.setVersion(SAMLVersion.VERSION_10);
        } else {
            assertion.setVersion(SAMLVersion.VERSION_11);
        }
    } else {
        super.processAttribute(samlObject, attribute);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:AssertionUnmarshaller.java


示例2: processAttribute

import org.opensaml.common.SAMLVersion; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
    Assertion assertion = (Assertion) samlObject;

    if (attribute.getLocalName().equals(Assertion.VERSION_ATTRIB_NAME)) {
        assertion.setVersion(SAMLVersion.valueOf(attribute.getValue()));
    } else if (attribute.getLocalName().equals(Assertion.ISSUE_INSTANT_ATTRIB_NAME)
            && !DatatypeHelper.isEmpty(attribute.getValue())) {
        assertion.setIssueInstant(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
    } else if (attribute.getLocalName().equals(Assertion.ID_ATTRIB_NAME)) {
        assertion.setID(attribute.getValue());
        attribute.getOwnerElement().setIdAttributeNode(attribute, true);
    } else {
        super.processAttribute(samlObject, attribute);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:AssertionUnmarshaller.java


示例3: processAttribute

import org.opensaml.common.SAMLVersion; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
    RequestAbstractType req = (RequestAbstractType) samlObject;

    if (attribute.getLocalName().equals(RequestAbstractType.VERSION_ATTRIB_NAME)) {
        req.setVersion(SAMLVersion.valueOf(attribute.getValue()));
    } else if (attribute.getLocalName().equals(RequestAbstractType.ID_ATTRIB_NAME)) {
        req.setID(attribute.getValue());
        attribute.getOwnerElement().setIdAttributeNode(attribute, true);
    } else if (attribute.getLocalName().equals(RequestAbstractType.ISSUE_INSTANT_ATTRIB_NAME)
            && !DatatypeHelper.isEmpty(attribute.getValue())) {
        req.setIssueInstant(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
    } else if (attribute.getLocalName().equals(RequestAbstractType.DESTINATION_ATTRIB_NAME)) {
        req.setDestination(attribute.getValue());
    } else if (attribute.getLocalName().equals(RequestAbstractType.CONSENT_ATTRIB_NAME)) {
        req.setConsent(attribute.getValue());
    } else {
        super.processAttribute(samlObject, attribute);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:RequestAbstractTypeUnmarshaller.java


示例4: processAttribute

import org.opensaml.common.SAMLVersion; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
    StatusResponseType sr = (StatusResponseType) samlObject;

    if (attribute.getLocalName().equals(StatusResponseType.VERSION_ATTRIB_NAME)) {
        sr.setVersion(SAMLVersion.valueOf(attribute.getValue()));
    } else if (attribute.getLocalName().equals(StatusResponseType.ID_ATTRIB_NAME)) {
        sr.setID(attribute.getValue());
        attribute.getOwnerElement().setIdAttributeNode(attribute, true);
    } else if (attribute.getLocalName().equals(StatusResponseType.IN_RESPONSE_TO_ATTRIB_NAME)) {
        sr.setInResponseTo(attribute.getValue());
    } else if (attribute.getLocalName().equals(StatusResponseType.ISSUE_INSTANT_ATTRIB_NAME)
            && !DatatypeHelper.isEmpty(attribute.getValue())) {
        sr.setIssueInstant(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
    } else if (attribute.getLocalName().equals(StatusResponseType.DESTINATION_ATTRIB_NAME)) {
        sr.setDestination(attribute.getValue());
    } else if (attribute.getLocalName().equals(StatusResponseType.CONSENT_ATTRIB_NAME)) {
        sr.setConsent(attribute.getValue());
    } else {
        super.processAttribute(samlObject, attribute);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:StatusResponseTypeUnmarshaller.java


示例5: buildAuthenticationRequest

import org.opensaml.common.SAMLVersion; //导入依赖的package包/类
public AuthnRequest buildAuthenticationRequest(String assertionConsumerServiceUrl, Integer assertionConsumerServiceIndex, String issuerId, String id, String destination) {
	DateTime issueInstant = new DateTime();
	AuthnRequestBuilder authRequestBuilder = new AuthnRequestBuilder();

	AuthnRequest authRequest = authRequestBuilder.buildObject(SAML2_PROTOCOL, "AuthnRequest", "samlp");
	authRequest.setIsPassive(Boolean.FALSE);
	authRequest.setIssueInstant(issueInstant);
	authRequest.setProtocolBinding(SAML2_POST_BINDING);
	authRequest.setAssertionConsumerServiceURL(assertionConsumerServiceUrl);
	authRequest.setAssertionConsumerServiceIndex(assertionConsumerServiceIndex);
	authRequest.setIssuer(buildIssuer(issuerId));
	authRequest.setNameIDPolicy(buildNameIDPolicy());
	authRequest.setRequestedAuthnContext(buildRequestedAuthnContext());
	authRequest.setID(id);
	authRequest.setVersion(SAMLVersion.VERSION_20);

	authRequest.setAttributeConsumingServiceIndex(1);
	authRequest.setDestination(destination);

	// firma la request
	authRequest.setSignature(spidIntegrationUtil.getSignature());

	return authRequest;
}
 
开发者ID:italia,项目名称:spid-spring,代码行数:25,代码来源:AuthenticationInfoExtractor.java


示例6: createAuthnRequest

import org.opensaml.common.SAMLVersion; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private AuthnRequest createAuthnRequest(String surl, 
                boolean fauth, boolean isp, String proto,
                      NameIDPolicy npolicy, RequestedAuthnContext actx) {

  AuthnRequest ar = ((SAMLObjectBuilder<AuthnRequest>) 
  _bf.getBuilder(AuthnRequest.DEFAULT_ELEMENT_NAME)).buildObject();
  ar.setAssertionConsumerServiceURL(surl);
  ar.setForceAuthn(fauth);
  String uid = UUID.randomUUID().toString();
  
  ar.setID(uid);
  ar.setIsPassive(isp);
  ar.setIssueInstant(new DateTime());
  ar.setProtocolBinding(proto);
  ar.setVersion(SAMLVersion.VERSION_20);
  ar.setIssuer(getIssuer());
  // ar.setNameIDPolicy(npolicy);
  // ar.setRequestedAuthnContext(actx);
  
  return ar;
}
 
开发者ID:osbitools,项目名称:OsBiToolsWs,代码行数:23,代码来源:SamlSecurityProvider.java


示例7: createLogoutRequest

import org.opensaml.common.SAMLVersion; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public LogoutRequest createLogoutRequest(Response resp) {
  LogoutRequest lr = ((SAMLObjectBuilder<LogoutRequest>) 
        _bf.getBuilder(LogoutRequest.DEFAULT_ELEMENT_NAME)).buildObject();
  String uid = UUID.randomUUID().toString();
  
  lr.setID(uid);
  lr.setIssueInstant(new DateTime());
  lr.setVersion(SAMLVersion.VERSION_20);
  lr.setIssuer(getIssuer());
  
  // Get NameID and SessionIndex from first assertion from
  // Authentication Response object
  Assertion asr = resp.getAssertions().get(0);
  NameID nid = ((SAMLObjectBuilder<NameID>) 
      _bf.getBuilder(NameID.DEFAULT_ELEMENT_NAME)).buildObject();
  nid.setValue(asr.getSubject().getNameID().getValue());
  lr.setNameID(nid);
  
  // Set session index(es)
  List<AuthnStatement> ausl = asr.getAuthnStatements();
  if (ausl != null) {
    for (AuthnStatement aus :ausl) {
      SessionIndex sindex = ((SAMLObjectBuilder<SessionIndex>) 
          _bf.getBuilder(SessionIndex.DEFAULT_ELEMENT_NAME)).buildObject();
      sindex.setSessionIndex(aus.getSessionIndex());
      lr.getSessionIndexes().add(sindex);
    }
  }
  
  return lr;
}
 
开发者ID:osbitools,项目名称:OsBiToolsWs,代码行数:33,代码来源:SamlSecurityProvider.java


示例8: validateAssertion

import org.opensaml.common.SAMLVersion; //导入依赖的package包/类
/**
   * Validate whether a SAML assertion contains the expected elements
   * @param validator The validator to use forassertion validation. Can be <code>null</code>.
   * @param spEntityID The entityID of the service provider
   * @param spAssertionConsumerURL The assertion consumer URL of the service provider
   */
  public void validateAssertion(AssertionValidator validator, String spEntityID, String spAssertionConsumerURL) throws ValidationException {
  	try {
	assertion.validate(false);
} catch (org.opensaml.xml.validation.ValidationException e) {
	throw new ValidationException(e);
}
// The SAML version must be 2.0
if (!SAMLVersion.VERSION_20.equals(assertion.getVersion())) {  
	throw new ValidationException("The assertion must be version 2.0. Was " + assertion.getVersion());
}
  	// There must be an ID
  	if (assertion.getID() == null) {  
  		throw new ValidationException("The assertion must contain a ID");
  	}
  	
  	log.debug("Using validator: " + validator);
  	if (validator != null) {
  		validator.validate(this, spEntityID, spAssertionConsumerURL);
  	}
  }
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:27,代码来源:OIOAssertion.java


示例9: newQuery

import org.opensaml.common.SAMLVersion; //导入依赖的package包/类
public static OIOAttributeQuery newQuery(String endpointLocation, String nameId, NameIDFormat format, String spEntityId) {
	
	org.opensaml.saml2.core.AttributeQuery q = SAMLUtil.buildXMLObject(org.opensaml.saml2.core.AttributeQuery.class);
	q.setVersion(SAMLVersion.VERSION_20);
	
	Subject subject = SAMLUtil.createSubject(nameId, endpointLocation, new DateTime().plusMinutes(5));
	subject.getSubjectConfirmations().clear();
	subject.getNameID().setFormat(format.getFormat());
	
	q.setSubject(subject);
	
	q.setDestination(endpointLocation);
	q.setIssueInstant(new DateTime());
	q.setID(Utils.generateUUID());
	q.setIssuer(SAMLUtil.createIssuer(spEntityId));
	q.setConsent("urn:oasis:names:tc:SAML:2.0:consent:current-implicit");
	
	return new OIOAttributeQuery(q);
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:20,代码来源:OIOAttributeQuery.java


示例10: buildRequest

import org.opensaml.common.SAMLVersion; //导入依赖的package包/类
public AuthnRequest buildRequest(String spProviderId, String acsUrl, String idpUrl){
/* Building Issuer object */
      IssuerBuilder issuerBuilder = new IssuerBuilder();
      Issuer issuer =
              issuerBuilder.buildObject("urn:oasis:names:tc:SAML:2.0:assertion",
                      "Issuer", "saml2p");
      issuer.setValue(spProviderId);

/* Creation of AuthRequestObject */
      DateTime issueInstant = new DateTime();
      AuthnRequestBuilder authRequestBuilder = new AuthnRequestBuilder();

      AuthnRequest authRequest =
              authRequestBuilder.buildObject(SAMLConstants.SAML20P_NS,
                      "AuthnRequest", "saml2p");
      authRequest.setForceAuthn(false);
      authRequest.setIssueInstant(issueInstant);
      authRequest.setProtocolBinding(SAMLConstants.SAML2_POST_BINDING_URI);
      authRequest.setAssertionConsumerServiceURL(acsUrl);
      authRequest.setIssuer(issuer);
      authRequest.setVersion(SAMLVersion.VERSION_20);
      authRequest.setDestination(idpUrl);

      return authRequest;
  }
 
开发者ID:imCodePartnerAB,项目名称:iVIS,代码行数:26,代码来源:SAMLRequestSender.java


示例11: buildResponse

import org.opensaml.common.SAMLVersion; //导入依赖的package包/类
public Response buildResponse(SAMLSSOAuthnReqDTO authReqDTO, Assertion assertion)
        throws IdentityException {

    if (log.isDebugEnabled()) {
        log.debug("Building SAML Response for the consumer '"
                + authReqDTO.getAssertionConsumerURL() + "'");
    }
    Response response = new org.opensaml.saml2.core.impl.ResponseBuilder().buildObject();
    response.setIssuer(SAMLSSOUtil.getIssuer());
    response.setID(SAMLSSOUtil.createID());
    response.setInResponseTo(authReqDTO.getId());
    response.setDestination(authReqDTO.getAssertionConsumerURL());
    response.setStatus(buildStatus(SAMLSSOConstants.StatusCodes.SUCCESS_CODE, null));
    response.setVersion(SAMLVersion.VERSION_20);
    DateTime issueInstant = new DateTime();
    response.setIssueInstant(issueInstant);
    response.getAssertions().add(assertion);
    if (authReqDTO.isDoSignResponse()) {
        SAMLSSOUtil.setSignature(response, authReqDTO.getSigningAlgorithmUri(), authReqDTO.getDigestAlgorithmUri
                (), new SignKeyDataHolder(authReqDTO.getUser().getAuthenticatedSubjectIdentifier()));
    }
    return response;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:24,代码来源:DefaultResponseBuilder.java


示例12: buildResponse

import org.opensaml.common.SAMLVersion; //导入依赖的package包/类
/**
 * Build the error response
 *
 * @param inResponseToID
 * @param statusCodes
 * @param statusMsg
 * @return
 */
public Response buildResponse(String inResponseToID, List<String> statusCodes, String statusMsg,
                              String destination) throws IdentityException {
    if (statusCodes == null || statusCodes.isEmpty()) {
        throw IdentityException.error("No Status Values");
    }
    response.setIssuer(SAMLSSOUtil.getIssuer());
    Status status = new StatusBuilder().buildObject();
    StatusCode statusCode = null;
    for (String statCode : statusCodes) {
        statusCode = buildStatusCode(statCode, statusCode);
    }
    status.setStatusCode(statusCode);
    buildStatusMsg(status, statusMsg);
    response.setStatus(status);
    response.setVersion(SAMLVersion.VERSION_20);
    response.setID(SAMLSSOUtil.createID());
    if (inResponseToID != null) {
        response.setInResponseTo(inResponseToID);
    }
    if (destination != null) {
        response.setDestination(destination);
    }
    response.setIssueInstant(new DateTime());
    return response;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:34,代码来源:ErrorResponseBuilder.java


示例13: generateErrorneousResponse

import org.opensaml.common.SAMLVersion; //导入依赖的package包/类
public static String generateErrorneousResponse() {
    Response response = new ResponseBuilder().buildObject();
    response.setIssuer(getIssuer());
    response.setStatus(buildStatus());
    response.setVersion(SAMLVersion.VERSION_20);
    response.setID(UIDGenerator.generateUID());

    try {
        return encode(marshall(response));
    } catch (IdentityException e) {
        if (log.isDebugEnabled()) {
            log.debug("Error while encoding.", e);
        }
        return null;
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:17,代码来源:ErrorResponseBuilder.java


示例14: testUnmarshall

import org.opensaml.common.SAMLVersion; //导入依赖的package包/类
/** {@inheritDoc} */
public void testUnmarshall() {
    AuthnRequest request = (AuthnRequest) unmarshallElement(elementFile);
    
    assertNotNull("AuthnRequest was null", request);
    assertEquals("ForceAuthn", true, request.isForceAuthn().booleanValue());
    assertEquals("AssertionConsumerServiceURL", "http://www.example.com/", request.getAssertionConsumerServiceURL());
    assertEquals("AttributeConsumingServiceIndex", 0, request.getAttributeConsumingServiceIndex().intValue());
    assertEquals("ProviderName", "SomeProvider", request.getProviderName());
    assertEquals("ID", "abe567de6", request.getID());
    assertEquals("Version", SAMLVersion.VERSION_20.toString(), request.getVersion().toString());
    assertEquals("IssueInstant", new DateTime(2005, 1, 31, 12, 0, 0, 0, ISOChronology.getInstanceUTC()), request.getIssueInstant());
    assertEquals("Destination", "http://www.example.com/", request.getDestination());
    assertEquals("Consent", "urn:oasis:names:tc:SAML:2.0:consent:obtained", request.getConsent());
    assertEquals("Subject/NameID/@NameIdFormat", "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress", request.getSubject().getNameID().getFormat());
    assertEquals("Subject/NameID contents", "[email protected]", request.getSubject().getNameID().getValue());
    Audience audience = request.getConditions().getAudienceRestrictions().get(0).getAudiences().get(0);
    assertEquals("Conditions/AudienceRestriction[1]/Audience[1] contents", "urn:foo:sp.example.org", audience.getAudienceURI());
    AuthnContextClassRef classRef = (AuthnContextClassRef) request.getRequestedAuthnContext().getAuthnContextClassRefs().get(0);
    assertEquals("RequestedAuthnContext/AuthnContextClassRef[1] contents", "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport", classRef.getAuthnContextClassRef());
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:22,代码来源:AuthnRequestTest.java


示例15: setUp

import org.opensaml.common.SAMLVersion; //导入依赖的package包/类
/** {@inheritDoc} */
protected void setUp() throws Exception {
    super.setUp();
    expectedID = "def456";
    expectedInResponseTo = "abc123";
    expectedSAMLVersion = SAMLVersion.VERSION_20;
    expectedIssueInstant = new DateTime(2006, 2, 21, 16, 40, 0, 0, ISOChronology.getInstanceUTC());
    expectedDestination = "http://sp.example.org/endpoint";
    expectedConsent = "urn:string:consent";
    
    QName issuerQName = new QName(SAMLConstants.SAML20_NS, Issuer.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
    expectedIssuer = (Issuer) buildXMLObject(issuerQName);
    
    QName statusQName = new QName(SAMLConstants.SAML20P_NS, Status.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX);
    expectedStatus = (Status) buildXMLObject(statusQName);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:17,代码来源:StatusResponseTestBase.java


示例16: handle

import org.opensaml.common.SAMLVersion; //导入依赖的package包/类
public void handle(Callback[] callbacks)
    throws IOException, UnsupportedCallbackException {
    for (int i = 0; i < callbacks.length; i++) {
        if (callbacks[i] instanceof SAMLCallback) {
            SAMLCallback callback = (SAMLCallback) callbacks[i];
            callback.setSamlVersion(SAMLVersion.VERSION_20);
            callback.setIssuer(issuer);
            SubjectBean subjectBean = 
                new SubjectBean(
                    subjectName, subjectQualifier, confirmationMethod
                );
            if (SAML2Constants.CONF_HOLDER_KEY.equals(confirmationMethod)) {
                try {
                    KeyInfoBean keyInfo = createKeyInfo();
                    subjectBean.setKeyInfo(keyInfo);
                } catch (Exception ex) {
                    throw new IOException("Problem creating KeyInfo: " +  ex.getMessage());
                }
            }
            callback.setSubject(subjectBean);
            createAndSetStatement(null, callback);
        } else {
            throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");
        }
    }
}
 
开发者ID:jaminh,项目名称:spring-saml-example-war,代码行数:27,代码来源:SAML2CallbackHandler.java


示例17: buildLogoutResponse

import org.opensaml.common.SAMLVersion; //导入依赖的package包/类
/**
 * Build a SAML2 Single Logout Response.
 * 
 * @param binding
 *            the request binding
 * @return the authentication request
 */
protected LogoutResponse buildLogoutResponse(final SamlBindingEnum binding) {
	final DateTime issueInstant = new DateTime();
	final LogoutResponse logoutResponse = this.logoutResponseBuilder
			.buildObject(LogoutResponse.DEFAULT_ELEMENT_NAME);

	logoutResponse.setIssueInstant(issueInstant);
	logoutResponse.setIssuer(this.buildIssuer());

	logoutResponse.setDestination(this.idpConfig.getIdpSloEndpointUrl(binding));
	logoutResponse.setVersion(SAMLVersion.VERSION_20);

	this.getSaml20SpProcessor().signSamlObject(logoutResponse);

	return logoutResponse;
}
 
开发者ID:mxbossard,项目名称:java-saml2-sp,代码行数:23,代码来源:OpenSaml20IdpConnector.java


示例18: renderMergedOutputModel

import org.opensaml.common.SAMLVersion; //导入依赖的package包/类
@Override
protected void renderMergedOutputModel(
        final Map<String, Object> model, final HttpServletRequest request, final HttpServletResponse response) throws Exception {

    response.setCharacterEncoding(this.encoding);

    final WebApplicationService service = this.samlArgumentExtractor.extractService(request);
    final String serviceId = service != null ? service.getId() : "UNKNOWN";

    try {
        final Response samlResponse = newSamlObject(Response.class);
        samlResponse.setID(generateId());
        samlResponse.setIssueInstant(new DateTime());
        samlResponse.setVersion(SAMLVersion.VERSION_11);
        samlResponse.setRecipient(serviceId);
        if (service instanceof SamlService) {
            final SamlService samlService = (SamlService) service;

            if (samlService.getRequestID() != null) {
                samlResponse.setInResponseTo(samlService.getRequestID());
            }
        }
        prepareResponse(samlResponse, model);

        final BasicSAMLMessageContext messageContext = new BasicSAMLMessageContext();
        messageContext.setOutboundMessageTransport(new HttpServletResponseAdapter(response, request.isSecure()));
        messageContext.setOutboundSAMLMessage(samlResponse);
        this.encoder.encode(messageContext);
    } catch (final Exception e) {
        logger.error("Error generating SAML response for service {}.", serviceId);
        throw e;
    }
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:34,代码来源:AbstractSaml10ResponseView.java


示例19: processAttribute

import org.opensaml.common.SAMLVersion; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
    ResponseAbstractType response = (ResponseAbstractType) samlObject;

    if (attribute.getLocalName().equals(ResponseAbstractType.ID_ATTRIB_NAME)) {
        response.setID(attribute.getValue());
    } else if (attribute.getLocalName().equals(ResponseAbstractType.INRESPONSETO_ATTRIB_NAME)) {
        response.setInResponseTo(attribute.getValue());
    } else if (attribute.getLocalName().equals(ResponseAbstractType.ISSUEINSTANT_ATTRIB_NAME)
            && !DatatypeHelper.isEmpty(attribute.getValue())) {
        response.setIssueInstant(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
    } else if (attribute.getLocalName().equals(ResponseAbstractType.MINORVERSION_ATTRIB_NAME)) {
        int minor;
        try {
            minor = Integer.parseInt(attribute.getValue());
        } catch (NumberFormatException n) {
            log.error("Parsing minor version ", n);
            throw new UnmarshallingException(n);
        }
        if (minor == 0) {
            response.setVersion(SAMLVersion.VERSION_10);
        } else if (minor == 1) {
            response.setVersion(SAMLVersion.VERSION_11);
        }
    } else if (attribute.getLocalName().equals(ResponseAbstractType.RECIPIENT_ATTRIB_NAME)) {
        response.setRecipient(attribute.getValue());
    } else {
        super.processAttribute(samlObject, attribute);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:31,代码来源:ResponseAbstractTypeUnmarshaller.java


示例20: processAttribute

import org.opensaml.common.SAMLVersion; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlElement, Attr attribute) throws UnmarshallingException {
    RequestAbstractType request = (RequestAbstractType) samlElement;

    if (RequestAbstractType.ID_ATTRIB_NAME.equals(attribute.getLocalName())) {
        request.setID(attribute.getValue());
    } else if (RequestAbstractType.ISSUEINSTANT_ATTRIB_NAME.equals(attribute.getLocalName())
            && !DatatypeHelper.isEmpty(attribute.getValue())) {
        DateTime cal = new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC());
        request.setIssueInstant(cal);
    } else if (RequestAbstractType.MINORVERSION_ATTRIB_NAME.equals(attribute.getLocalName())) {
        int minor;
        try {
            minor = Integer.parseInt(attribute.getValue());
        } catch (NumberFormatException n) {
            log.error("Unable to parse minor version string", n);
            throw new UnmarshallingException(n);
        }
        if (minor == 0) {
            request.setVersion(SAMLVersion.VERSION_10);
        } else if (minor == 1) {
            request.setVersion(SAMLVersion.VERSION_11);
        }
    } else {
        super.processAttribute(samlElement, attribute);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:28,代码来源:RequestAbstractTypeUnmarshaller.java



注:本文中的org.opensaml.common.SAMLVersion类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ServerError类代码示例发布时间:2022-05-21
下一篇:
Java XsdSchema类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap