@SuppressWarnings("unchecked") public void handleRequestType(SAML2HandlerRequest request, SAML2HandlerResponse response) throws ProcessingException { // Do not handle log out request interaction if (request.getSAML2Object() instanceof LogoutRequestType) return; // only handle IDP side if (getType() == HANDLER_TYPE.SP) return; HTTPContext httpContext = (HTTPContext) request.getContext(); HttpSession session = httpContext.getRequest().getSession(false); Principal userPrincipal = (Principal) session.getAttribute(GeneralConstants.PRINCIPAL_ID); if (userPrincipal == null) userPrincipal = httpContext.getRequest().getUserPrincipal(); Map<String, Object> attribs = (Map<String, Object>) session.getAttribute(GeneralConstants.ATTRIBUTES); if (attribs == null) { attribs = this.attribManager.getAttributes(userPrincipal, attributeKeys); request.addOption(GeneralConstants.ATTRIBUTES, attribs); session.setAttribute(GeneralConstants.ATTRIBUTES, attribs); } }
private SAML2HandlerResponse processHandlersChain(HTTPContext httpContext, Set<SAML2Handler> handlers, Lock chainLock, SAMLDocumentHolder documentHolder) throws ConfigurationException, ProcessingException, TrustKeyConfigurationException, TrustKeyProcessingException, IOException { // Create the request/response SAML2HandlerRequest saml2HandlerRequest = getSAML2HandlerRequest(documentHolder, httpContext); SAML2HandlerResponse saml2HandlerResponse = new DefaultSAML2HandlerResponse(); SAMLHandlerChainProcessor chainProcessor = new SAMLHandlerChainProcessor(handlers); // Set some request options setRequestOptions(saml2HandlerRequest); saml2HandlerRequest.addOption(GeneralConstants.CONTEXT_PATH, httpContext.getServletContext().getContextPath()); saml2HandlerRequest.addOption(GeneralConstants.SUPPORTS_SIGNATURES, this.spConfiguration.isSupportsSignature()); chainProcessor.callHandlerChain(documentHolder.getSamlObject(), saml2HandlerRequest, saml2HandlerResponse, httpContext, chainLock); return saml2HandlerResponse; }
@SuppressWarnings("unchecked") public void handleRequestType(SAML2HandlerRequest request, SAML2HandlerResponse response) throws ProcessingException { // Do not handle log out request interaction SAML2Object saml2Object = request.getSAML2Object(); if (saml2Object instanceof LogoutRequestType) return; // only handle IDP side if (getType() == HANDLER_TYPE.SP) return; HTTPContext httpContext = (HTTPContext) request.getContext(); HttpSession session = httpContext.getRequest().getSession(false); Principal userPrincipal = (Principal) session.getAttribute(GeneralConstants.PRINCIPAL_ID); AuthnRequestType authnRequestType = (AuthnRequestType) saml2Object; if (userPrincipal == null) { userPrincipal = httpContext.getRequest().getUserPrincipal(); } Map<String, Object> sessionAttributes = (Map<String, Object>) session.getAttribute(GeneralConstants.ATTRIBUTES); if (sessionAttributes == null) { Set<AttributeStatementType> attributes = this.attribManager.getAttributes(authnRequestType, userPrincipal); request.addOption(GeneralConstants.ATTRIBUTES, attributes); session.setAttribute(GeneralConstants.ATTRIBUTES, StatementUtil.asMap(attributes)); } }
@SuppressWarnings("unchecked") public void handleRequestType(SAML2HandlerRequest request, SAML2HandlerResponse response) throws ProcessingException { // Do not handle log out request interaction SAML2Object saml2Object = request.getSAML2Object(); if (saml2Object instanceof LogoutRequestType) return; // only handle IDP side if (getType() == HANDLER_TYPE.SP) return; HTTPContext httpContext = (HTTPContext) request.getContext(); HttpSession session = httpContext.getRequest().getSession(false); Principal userPrincipal = (Principal) session.getAttribute(GeneralConstants.PRINCIPAL_ID); AuthnRequestType authnRequestType = (AuthnRequestType) saml2Object; if (userPrincipal == null) { userPrincipal = httpContext.getRequest().getUserPrincipal(); } Map<String, Object> sessionAttributes = (Map<String, Object>) session.getAttribute(GeneralConstants.ATTRIBUTES); if (sessionAttributes == null) { Set<AttributeStatementType> attributes = this.attribManager.getAttributes(authnRequestType, userPrincipal); request.addOption(GeneralConstants.ATTRIBUTES, attributes); session.setAttribute(GeneralConstants.ATTRIBUTES, StatementUtil.asMap(attributes)); } }
private SAML2HandlerResponse processHandlersChain(HTTPContext httpContext, Set<SAML2Handler> handlers, Lock chainLock, SAMLDocumentHolder documentHolder) throws ConfigurationException, ProcessingException, IOException { // Create the request/response SAML2HandlerRequest saml2HandlerRequest = getSAML2HandlerRequest(documentHolder, httpContext); SAML2HandlerResponse saml2HandlerResponse = new DefaultSAML2HandlerResponse(); SAMLHandlerChainProcessor chainProcessor = new SAMLHandlerChainProcessor(handlers, this.configuration); // Set some request options setRequestOptions(saml2HandlerRequest); saml2HandlerRequest.addOption(GeneralConstants.CONTEXT_PATH, httpContext.getServletContext().getContextPath()); saml2HandlerRequest.addOption(GeneralConstants.SUPPORTS_SIGNATURES, getSpConfiguration().isSupportsSignature()); chainProcessor.callHandlerChain(documentHolder.getSamlObject(), saml2HandlerRequest, saml2HandlerResponse, httpContext, chainLock); return saml2HandlerResponse; }
private SAML2HandlerResponse processHandlersChain(HTTPContext httpContext, Set<SAML2Handler> handlers, Lock chainLock, SAMLDocumentHolder documentHolder) throws ConfigurationException, ProcessingException, IOException { // Create the request/response SAML2HandlerRequest saml2HandlerRequest = getSAML2HandlerRequest(documentHolder, httpContext); SAML2HandlerResponse saml2HandlerResponse = new DefaultSAML2HandlerResponse(); SAMLHandlerChainProcessor chainProcessor = new SAMLHandlerChainProcessor(handlers, this.configuration); // Set some request options setRequestOptions(saml2HandlerRequest); saml2HandlerRequest.addOption(GeneralConstants.CONTEXT_PATH, httpContext.getServletContext().getContextPath()); saml2HandlerRequest.addOption(GeneralConstants.SUPPORTS_SIGNATURES, getSpConfiguration().isSupportsSignature()); chainProcessor.callHandlerChain(documentHolder.getSamlObject(), saml2HandlerRequest, saml2HandlerResponse, httpContext, chainLock); return saml2HandlerResponse; }
request.addOption(GeneralConstants.ASSERTION, assertion);
request.addOption(GeneralConstants.ASSERTION, assertion);
request.addOption(GeneralConstants.ASSERTION, assertion);
request.addOption(GeneralConstants.ASSERTION, assertion);
request.addOption(GeneralConstants.ASSERTION, assertion);
saml2HandlerRequest.setRelayState(relayState); if (StringUtil.isNotNull(loginType)) { saml2HandlerRequest.addOption(GeneralConstants.LOGIN_TYPE, loginType);
request.addOption(GeneralConstants.AUTH_REQUEST_ID, id); } catch (Exception e) { throw logger.processingError(e);
request.addOption(GeneralConstants.AUTH_REQUEST_ID, id); } catch (Exception e) { throw logger.processingError(e);
request.addOption(GeneralConstants.AUTH_REQUEST_ID, id); } catch (Exception e) { throw logger.processingError(e);
request.addOption(GeneralConstants.AUTH_REQUEST_ID, id);
request.addOption(GeneralConstants.AUTH_REQUEST_ID, id);