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

Java SAMLObject类代码示例

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

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



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

示例1: encodeSamlResponse

import org.opensaml.saml.common.SAMLObject; //导入依赖的package包/类
/**
 * Encode response and pass it onto the outbound transport.
 * Uses {@link CasHttpSoap11Encoder} to handle encoding.
 *
 * @param httpResponse the http response
 * @param httpRequest the http request
 * @param samlMessage the saml response
 * @throws Exception the exception in case encoding fails.
 */
public void encodeSamlResponse(final HttpServletResponse httpResponse,
                               final HttpServletRequest httpRequest,
                               final Response samlMessage) throws Exception {

    SamlUtils.logSamlObject(this.configBean, samlMessage);
    
    final HTTPSOAP11Encoder encoder = new CasHttpSoap11Encoder();
    final MessageContext<SAMLObject> context = new MessageContext();
    context.setMessage(samlMessage);
    encoder.setHttpServletResponse(httpResponse);
    encoder.setMessageContext(context);
    encoder.initialize();
    encoder.prepareContext();
    encoder.encode();
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:25,代码来源:Saml10ObjectBuilder.java


示例2: encryptAssertion

import org.opensaml.saml.common.SAMLObject; //导入依赖的package包/类
/**
 * Encrypt assertion.
 *
 * @param assertion the assertion
 * @param request   the request
 * @param response  the response
 * @param service   the service
 * @param adaptor   the adaptor
 * @return the saml object
 * @throws SamlException the saml exception
 */
protected SAMLObject encryptAssertion(final Assertion assertion,
                                      final HttpServletRequest request, final HttpServletResponse response,
                                      final SamlRegisteredService service,
                                      final SamlRegisteredServiceServiceProviderMetadataFacade adaptor) throws SamlException {
    try {
        if (service.isEncryptAssertions()) {
            LOGGER.info("SAML service [{}] requires assertions to be encrypted", adaptor.getEntityId());
            final EncryptedAssertion encryptedAssertion =
                    this.samlObjectEncrypter.encode(assertion, service, adaptor, response, request);
            return encryptedAssertion;
        }
        LOGGER.info("SAML registered service [{}] does not require assertions to be encrypted", adaptor.getEntityId());
        return assertion;
    } catch (final Exception e) {
        throw new SamlException("Unable to marshall assertion for encryption", e);
    }
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:29,代码来源:BaseSamlProfileSamlResponseBuilder.java


示例3: encode

import org.opensaml.saml.common.SAMLObject; //导入依赖的package包/类
/**
 * Encode a given saml object by invoking a number of outbound security handlers on the context.
 *
 * @param <T>        the type parameter
 * @param samlObject the saml object
 * @param service    the service
 * @param adaptor    the adaptor
 * @param response   the response
 * @param request    the request
 * @param binding    the binding
 * @return the t
 * @throws SamlException the saml exception
 */
public <T extends SAMLObject> T encode(final T samlObject,
                                       final SamlRegisteredService service,
                                       final SamlRegisteredServiceServiceProviderMetadataFacade adaptor,
                                       final HttpServletResponse response,
                                       final HttpServletRequest request,
                                       final String binding) throws SamlException {
    try {
        LOGGER.debug("Attempting to encode [{}] for [{}]", samlObject.getClass().getName(), adaptor.getEntityId());
        final MessageContext<T> outboundContext = new MessageContext<>();
        prepareOutboundContext(samlObject, adaptor, outboundContext, binding);
        prepareSecurityParametersContext(adaptor, outboundContext);
        prepareEndpointURLSchemeSecurityHandler(outboundContext);
        prepareSamlOutboundDestinationHandler(outboundContext);
        prepareSamlOutboundProtocolMessageSigningHandler(outboundContext);
        return samlObject;
    } catch (final Exception e) {
        throw new SamlException(e.getMessage(), e);
    }
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:33,代码来源:BaseSamlObjectSigner.java


示例4: doEncode

import org.opensaml.saml.common.SAMLObject; //导入依赖的package包/类
@Override
protected void doEncode() throws MessageEncodingException {
    final MessageContext messageContext = this.getMessageContext();
    final SAMLObject outboundMessage = (SAMLObject)messageContext.getMessage();
    final String endpointURL = this.getEndpointURL(messageContext).toString();
    
    if (!this.forceSignRedirectBindingAuthnRequest) {
        this.removeSignature(outboundMessage);
    }
    
    final String encodedMessage = this.deflateAndBase64Encode(outboundMessage);
    final String redirectURL = this.buildRedirectURL(messageContext, endpointURL, encodedMessage);

    responseAdapter.init();
    responseAdapter.setRedirectUrl(redirectURL);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:17,代码来源:Pac4jHTTPRedirectDeflateEncoder.java


示例5: deflateAndBase64Encode

import org.opensaml.saml.common.SAMLObject; //导入依赖的package包/类
/**
 * DEFLATE (RFC1951) compresses the given SAML message.
 *
 * @param message SAML message
 *
 * @return DEFLATE compressed message
 *
 * @throws MessageEncodingException thrown if there is a problem compressing the message
 */
protected String deflateAndBase64Encode(SAMLObject message) throws MessageEncodingException {
    log.debug("Deflating and Base64 encoding SAML message");
    try {
        String messageStr = SerializeSupport.nodeToString(marshallMessage(message));

        ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
        Deflater deflater = new Deflater(Deflater.DEFLATED, true);
        DeflaterOutputStream deflaterStream = new DeflaterOutputStream(bytesOut, deflater);
        deflaterStream.write(messageStr.getBytes("UTF-8"));
        deflaterStream.finish();

        return Base64Support.encode(bytesOut.toByteArray(), Base64Support.UNCHUNKED);
    } catch (IOException e) {
        throw new MessageEncodingException("Unable to DEFLATE and Base64 encode SAML message", e);
    }
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:26,代码来源:Pac4jHTTPRedirectDeflateEncoder.java


示例6: postEncode

import org.opensaml.saml.common.SAMLObject; //导入依赖的package包/类
protected void postEncode(final MessageContext<SAMLObject> messageContext, final String endpointURL) throws MessageEncodingException {
    log.debug("Invoking Velocity template to create POST body");

    try {
        final VelocityContext e = new VelocityContext();
        this.populateVelocityContext(e, messageContext, endpointURL);

        responseAdapter.setContentType("text/html");
        responseAdapter.init();

        final OutputStreamWriter out = responseAdapter.getOutputStreamWriter();
        this.getVelocityEngine().mergeTemplate(this.getVelocityTemplateId(), "UTF-8", e, out);
        out.flush();
    } catch (Exception var6) {
        throw new MessageEncodingException("Error creating output document", var6);
    }
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:18,代码来源:Pac4jHTTPPostEncoder.java


示例7: doDecode

import org.opensaml.saml.common.SAMLObject; //导入依赖的package包/类
@Override
protected void doDecode() throws MessageDecodingException {
    final MessageContext messageContext = new MessageContext();

    if(!"POST".equalsIgnoreCase(this.context.getRequestMethod())) {
        throw new MessageDecodingException("This message decoder only supports the HTTP POST method");
    } else {
        final String relayState = this.context.getRequestParameter("RelayState");
        logger.debug("Decoded SAML relay state of: {}", relayState);
        SAMLBindingSupport.setRelayState(messageContext, relayState);
        final InputStream base64DecodedMessage = this.getBase64DecodedMessage();
        final SAMLObject inboundMessage = (SAMLObject)this.unmarshallMessage(base64DecodedMessage);
        messageContext.setMessage(inboundMessage);
        logger.debug("Decoded SAML message");
        this.populateBindingContext(messageContext);
        this.setMessageContext(messageContext);
    }
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:19,代码来源:Pac4jHTTPPostDecoder.java


示例8: validate

import org.opensaml.saml.common.SAMLObject; //导入依赖的package包/类
/**
 * Validates the SAML protocol response and the SAML SSO response.
 * The method decrypt encrypted assertions if any.
 *
 * @param context the context
 */
@Override
public Credentials validate(final SAML2MessageContext context) {

    final SAMLObject message = context.getMessage();

    if (!(message instanceof Response)) {
        throw new SAMLException("Response instance is an unsupported type");
    }
    final Response response = (Response) message;
    final SignatureTrustEngine engine = this.signatureTrustEngineProvider.build();
    validateSamlProtocolResponse(response, context, engine);

    if (decrypter != null) {
        decryptEncryptedAssertions(response, decrypter);
    }

    validateSamlSSOResponse(response, context, engine, decrypter);
    return buildSAML2Credentials(context);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:26,代码来源:SAML2DefaultResponseValidator.java


示例9: doExecute

import org.opensaml.saml.common.SAMLObject; //导入依赖的package包/类
@Override
protected void doExecute(@Nonnull final ProfileRequestContext<SAMLObject, SAMLObject> profileRequestContext) {
   	logger.debug("Entering GenerateNewToken doExecute");
		
	try {
		LinotpConnection connection = new LinotpConnection(host, serviceUsername, servicePassword, checkCert);
		connection.requestAdminSession();
		List<LinotpTokenInfo> tokenList = connection.getTokenInfoList(username);
		
		if (createEmailToken && tokenList.size() == 0) {
			List<LinotpUser> userList = connection.getUserList("userid", username);
			if (userList.size() == 1) {
				connection.initEmailToken(username, userList.get(0).getEmail());
				tokenList = connection.getTokenInfoList(username);
			}
		}
		
		tokenCtx.setTokenList(tokenList);
		
		connection.generateToken(tokenCtx);
		
	} catch (Exception e) {
		logger.debug("Failed to create new token", e);
	}
	
}
 
开发者ID:cyber-simon,项目名称:idp-auth-linotp,代码行数:27,代码来源:TokenGenerator.java


示例10: doExecute

import org.opensaml.saml.common.SAMLObject; //导入依赖的package包/类
@Nonnull
@Override
protected Event doExecute(
        final @Nonnull RequestContext springRequestContext,
        final @Nonnull ProfileRequestContext<SAMLObject, SAMLObject> profileRequestContext) {

    final MessageContext<SAMLObject> msgContext = new MessageContext<>();
    try {
        msgContext.setMessage(buildSamlResponse(springRequestContext, profileRequestContext));
    } catch (IllegalStateException e) {
        return ProtocolError.IllegalState.event(this);
    }
    final SAMLBindingContext bindingContext = new SAMLBindingContext();
    bindingContext.setBindingUri(SAMLConstants.SAML1_SOAP11_BINDING_URI);
    msgContext.addSubcontext(bindingContext);
    profileRequestContext.setOutboundMessageContext(msgContext);

    // Return null to signal that other actions must follow this one before proceeding to next state
    return null;
}
 
开发者ID:serac,项目名称:shibboleth-idp-ext-cas,代码行数:21,代码来源:AbstractOutgoingSamlMessageAction.java


示例11: buildSamlResponse

import org.opensaml.saml.common.SAMLObject; //导入依赖的package包/类
@Nonnull
@Override
protected Response buildSamlResponse(
        final @Nonnull RequestContext springRequestContext,
        final @Nonnull ProfileRequestContext<SAMLObject, SAMLObject> profileRequestContext) {

    final String code = (String) springRequestContext.getFlashScope().get("code");
    final String detailCode = (String) springRequestContext.getFlashScope().get("detailCode");

    final Response response = newSAMLObject(Response.class, Response.DEFAULT_ELEMENT_NAME);
    final Status status = newSAMLObject(Status.class, Status.DEFAULT_ELEMENT_NAME);
    final StatusCode statusCode = newSAMLObject(StatusCode.class, StatusCode.DEFAULT_ELEMENT_NAME);
    statusCode.setValue(new QName(NAMESPACE, code));
    status.setStatusCode(statusCode);
    final StatusMessage message = newSAMLObject(StatusMessage.class, StatusMessage.DEFAULT_ELEMENT_NAME);
    message.setMessage(detailCode);
    status.setStatusMessage(message);
    response.setStatus(status);

    return response;
}
 
开发者ID:serac,项目名称:shibboleth-idp-ext-cas,代码行数:22,代码来源:BuildSamlValidationFailureMessageAction.java


示例12: newSamlObject

import org.opensaml.saml.common.SAMLObject; //导入依赖的package包/类
/**
 * Create a new SAML object.
 *
 * @param <T> the generic type
 * @param objectType the object type
 * @return the t
 */
public final <T extends SAMLObject> T newSamlObject(final Class<T> objectType) {
    final QName qName = getSamlObjectQName(objectType);
    final SAMLObjectBuilder<T> builder = (SAMLObjectBuilder<T>)
            XMLObjectProviderRegistrySupport.getBuilderFactory().getBuilder(qName);
    if (builder == null) {
        throw new IllegalStateException("No SAMLObjectBuilder registered for class " + objectType.getName());
    }
    return objectType.cast(builder.buildObject(qName));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:17,代码来源:AbstractSamlObjectBuilder.java


示例13: encodeSamlResponse

import org.opensaml.saml.common.SAMLObject; //导入依赖的package包/类
/**
 * Encode response and pass it onto the outbound transport.
 * Uses {@link CasHttpSoap11Encoder} to handle encoding.
 *
 * @param httpResponse the http response
 * @param httpRequest the http request
 * @param samlMessage the saml response
 * @throws Exception the exception in case encoding fails.
 */
public void encodeSamlResponse(final HttpServletResponse httpResponse,
                               final HttpServletRequest httpRequest,
                               final Response samlMessage) throws Exception {

    final HTTPSOAP11Encoder encoder = new CasHttpSoap11Encoder();
    final MessageContext<SAMLObject> context = new MessageContext();
    context.setMessage(samlMessage);
    encoder.setHttpServletResponse(httpResponse);
    encoder.setMessageContext(context);
    encoder.initialize();
    encoder.prepareContext();
    encoder.encode();
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:23,代码来源:Saml10ObjectBuilder.java


示例14: encodeSamlResponse

import org.opensaml.saml.common.SAMLObject; //导入依赖的package包/类
/**
 * Encode response and pass it onto the outbound transport.
 * Uses {@link CasHTTPSOAP11Encoder} to handle encoding.
 *
 * @param httpResponse the http response
 * @param httpRequest the http request
 * @param samlMessage the saml response
 * @throws Exception the exception in case encoding fails.
 */
public void encodeSamlResponse(final HttpServletResponse httpResponse,
                               final HttpServletRequest httpRequest,
                               final Response samlMessage) throws Exception {

    final HTTPSOAP11Encoder encoder = new CasHTTPSOAP11Encoder();
    final MessageContext<SAMLObject> context = new MessageContext();
    context.setMessage(samlMessage);
    encoder.setHttpServletResponse(httpResponse);
    encoder.setMessageContext(context);
    encoder.initialize();
    encoder.prepareContext();
    encoder.encode();
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:23,代码来源:Saml10ObjectBuilder.java


示例15: newSamlObject

import org.opensaml.saml.common.SAMLObject; //导入依赖的package包/类
/**
 * Create a new SAML object.
 *
 * @param <T>        the generic type
 * @param objectType the object type
 * @return the t
 */
public <T extends SAMLObject> T newSamlObject(final Class<T> objectType) {
    final QName qName = getSamlObjectQName(objectType);
    final SAMLObjectBuilder<T> builder = (SAMLObjectBuilder<T>)
            XMLObjectProviderRegistrySupport.getBuilderFactory().getBuilder(qName);
    if (builder == null) {
        throw new IllegalStateException("No SAML object builder is registered for class " + objectType.getName());
    }
    return objectType.cast(builder.buildObject(qName));
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:17,代码来源:AbstractSamlObjectBuilder.java


示例16: ECPProfileHandlerController

import org.opensaml.saml.common.SAMLObject; //导入依赖的package包/类
/**
 * Instantiates a new ecp saml profile handler controller.
 *
 * @param samlObjectSigner                             the saml object signer
 * @param parserPool                                   the parser pool
 * @param authenticationSystemSupport                  the authentication system support
 * @param servicesManager                              the services manager
 * @param webApplicationServiceFactory                 the web application service factory
 * @param samlRegisteredServiceCachingMetadataResolver the saml registered service caching metadata resolver
 * @param configBean                                   the config bean
 * @param responseBuilder                              the response builder
 * @param samlEcpFaultResponseBuilder                  the saml ecp fault response builder
 * @param authenticationContextClassMappings           the authentication context class mappings
 * @param serverPrefix                                 the server prefix
 * @param serverName                                   the server name
 * @param authenticationContextRequestParameter        the authentication context request parameter
 * @param loginUrl                                     the login url
 * @param logoutUrl                                    the logout url
 * @param forceSignedLogoutRequests                    the force signed logout requests
 * @param singleLogoutCallbacksDisabled                the single logout callbacks disabled
 * @param samlObjectSignatureValidator                 the saml object signature validator
 */
public ECPProfileHandlerController(final BaseSamlObjectSigner samlObjectSigner,
                                   final ParserPool parserPool,
                                   final AuthenticationSystemSupport authenticationSystemSupport,
                                   final ServicesManager servicesManager,
                                   final ServiceFactory<WebApplicationService> webApplicationServiceFactory,
                                   final SamlRegisteredServiceCachingMetadataResolver samlRegisteredServiceCachingMetadataResolver,
                                   final OpenSamlConfigBean configBean,
                                   final SamlProfileObjectBuilder<org.opensaml.saml.saml2.ecp.Response> responseBuilder,
                                   final SamlProfileObjectBuilder<? extends SAMLObject> samlEcpFaultResponseBuilder,
                                   final Set<String> authenticationContextClassMappings,
                                   final String serverPrefix,
                                   final String serverName,
                                   final String authenticationContextRequestParameter,
                                   final String loginUrl,
                                   final String logoutUrl,
                                   final boolean forceSignedLogoutRequests,
                                   final boolean singleLogoutCallbacksDisabled,
                                   final SamlObjectSignatureValidator samlObjectSignatureValidator) {
    super(samlObjectSigner, parserPool, authenticationSystemSupport,
            servicesManager, webApplicationServiceFactory,
            samlRegisteredServiceCachingMetadataResolver,
            configBean, responseBuilder,
            authenticationContextClassMappings,
            serverPrefix, serverName,
            authenticationContextRequestParameter, loginUrl, logoutUrl,
            forceSignedLogoutRequests, singleLogoutCallbacksDisabled,
            samlObjectSignatureValidator);
    this.samlEcpFaultResponseBuilder = samlEcpFaultResponseBuilder;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:52,代码来源:ECPProfileHandlerController.java


示例17: AbstractSamlProfileHandlerController

import org.opensaml.saml.common.SAMLObject; //导入依赖的package包/类
/**
 * Instantiates a new Abstract saml profile handler controller.
 *
 * @param samlObjectSigner                             the saml object signer
 * @param parserPool                                   the parser pool
 * @param authenticationSystemSupport                  the authentication system support
 * @param servicesManager                              the services manager
 * @param webApplicationServiceFactory                 the web application service factory
 * @param samlRegisteredServiceCachingMetadataResolver the saml registered service caching metadata resolver
 * @param configBean                                   the config bean
 * @param responseBuilder                              the response builder
 * @param authenticationContextClassMappings           the authentication context class mappings
 * @param serverPrefix                                 the server prefix
 * @param serverName                                   the server name
 * @param authenticationContextRequestParameter        the authentication context request parameter
 * @param loginUrl                                     the login url
 * @param logoutUrl                                    the logout url
 * @param forceSignedLogoutRequests                    the force signed logout requests
 * @param singleLogoutCallbacksDisabled                the single logout callbacks disabled
 * @param samlObjectSignatureValidator                 the saml object signature validator
 */
public AbstractSamlProfileHandlerController(final BaseSamlObjectSigner samlObjectSigner,
                                            final ParserPool parserPool,
                                            final AuthenticationSystemSupport authenticationSystemSupport,
                                            final ServicesManager servicesManager,
                                            final ServiceFactory<WebApplicationService> webApplicationServiceFactory,
                                            final SamlRegisteredServiceCachingMetadataResolver samlRegisteredServiceCachingMetadataResolver,
                                            final OpenSamlConfigBean configBean,
                                            final SamlProfileObjectBuilder<? extends SAMLObject> responseBuilder,
                                            final Set<String> authenticationContextClassMappings,
                                            final String serverPrefix,
                                            final String serverName,
                                            final String authenticationContextRequestParameter,
                                            final String loginUrl,
                                            final String logoutUrl,
                                            final boolean forceSignedLogoutRequests,
                                            final boolean singleLogoutCallbacksDisabled,
                                            final SamlObjectSignatureValidator samlObjectSignatureValidator) {
    this.samlObjectSigner = samlObjectSigner;
    this.parserPool = parserPool;
    this.servicesManager = servicesManager;
    this.webApplicationServiceFactory = webApplicationServiceFactory;
    this.samlRegisteredServiceCachingMetadataResolver = samlRegisteredServiceCachingMetadataResolver;
    this.configBean = configBean;
    this.responseBuilder = responseBuilder;
    this.authenticationContextClassMappings = authenticationContextClassMappings;
    this.serverPrefix = serverPrefix;
    this.serverName = serverName;
    this.authenticationContextRequestParameter = authenticationContextRequestParameter;
    this.loginUrl = loginUrl;
    this.logoutUrl = logoutUrl;
    this.forceSignedLogoutRequests = forceSignedLogoutRequests;
    this.singleLogoutCallbacksDisabled = singleLogoutCallbacksDisabled;
    this.authenticationSystemSupport = authenticationSystemSupport;
    this.samlObjectSignatureValidator = samlObjectSignatureValidator;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:57,代码来源:AbstractSamlProfileHandlerController.java


示例18: bindRelayStateParameter

import org.opensaml.saml.common.SAMLObject; //导入依赖的package包/类
private static MessageContext<SAMLObject> bindRelayStateParameter(final HttpServletRequest request) {
    final MessageContext<SAMLObject> messageContext = new MessageContext<>();
    final String relayState = request.getParameter(SamlProtocolConstants.PARAMETER_SAML_RELAY_STATE);
    LOGGER.debug("RelayState is [{}]", relayState);
    SAMLBindingSupport.setRelayState(messageContext, relayState);
    return messageContext;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:8,代码来源:SSOPostProfileCallbackHandlerController.java


示例19: SamlProfileSamlSoap11ResponseBuilder

import org.opensaml.saml.common.SAMLObject; //导入依赖的package包/类
public SamlProfileSamlSoap11ResponseBuilder(
        final OpenSamlConfigBean openSamlConfigBean,
        final BaseSamlObjectSigner samlObjectSigner,
        final VelocityEngineFactory velocityEngineFactory,
        final SamlProfileObjectBuilder<Assertion> samlProfileSamlAssertionBuilder,
        final SamlProfileObjectBuilder<? extends SAMLObject> saml2ResponseBuilder,
        final SamlObjectEncrypter samlObjectEncrypter) {
    super(openSamlConfigBean, samlObjectSigner, velocityEngineFactory, samlProfileSamlAssertionBuilder, samlObjectEncrypter);
    this.saml2ResponseBuilder = saml2ResponseBuilder;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:11,代码来源:SamlProfileSamlSoap11ResponseBuilder.java


示例20: buildResponse

import org.opensaml.saml.common.SAMLObject; //导入依赖的package包/类
@Override
protected Response buildResponse(final Assertion assertion,
                                 final org.jasig.cas.client.validation.Assertion casAssertion,
                                 final AuthnRequest authnRequest,
                                 final SamlRegisteredService service,
                                 final SamlRegisteredServiceServiceProviderMetadataFacade adaptor,
                                 final HttpServletRequest request,
                                 final HttpServletResponse response,
                                 final String binding) throws SamlException {
    final String id = '_' + String.valueOf(Math.abs(new SecureRandom().nextLong()));
    Response samlResponse = newResponse(id, ZonedDateTime.now(ZoneOffset.UTC), authnRequest.getID(), null);
    samlResponse.setVersion(SAMLVersion.VERSION_20);
    samlResponse.setIssuer(buildEntityIssuer());
    samlResponse.setConsent(RequestAbstractType.UNSPECIFIED_CONSENT);

    final SAMLObject finalAssertion = encryptAssertion(assertion, request, response, service, adaptor);

    if (finalAssertion instanceof EncryptedAssertion) {
        LOGGER.debug("Built assertion is encrypted, so the response will add it to the encrypted assertions collection");
        samlResponse.getEncryptedAssertions().add(EncryptedAssertion.class.cast(finalAssertion));
    } else {
        LOGGER.debug("Built assertion is not encrypted, so the response will add it to the assertions collection");
        samlResponse.getAssertions().add(Assertion.class.cast(finalAssertion));
    }

    final Status status = newStatus(StatusCode.SUCCESS, StatusCode.SUCCESS);
    samlResponse.setStatus(status);

    SamlUtils.logSamlObject(this.configBean, samlResponse);

    if (service.isSignResponses()) {
        LOGGER.debug("SAML entity id [{}] indicates that SAML responses should be signed", adaptor.getEntityId());
        samlResponse = this.samlObjectSigner.encode(samlResponse, service, adaptor, 
                response, request, binding);
    }

    return samlResponse;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:39,代码来源:SamlProfileSaml2ResponseBuilder.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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