@Override public AuthOutcome handle(OnSessionCreated onCreateSession) { return doHandle(new SamlInvocationContext(null, null, null), onCreateSession); } }
public AuthOutcome doHandle(SamlInvocationContext context, OnSessionCreated onCreateSession) { String samlRequest = context.getSamlRequest(); String samlResponse = context.getSamlResponse(); String relayState = context.getRelayState(); if (samlRequest != null) { return handleSamlRequest(samlRequest, relayState); } else if (samlResponse != null) { return handleSamlResponse(samlResponse, relayState, onCreateSession); } else if (sessionStore.isLoggedIn()) { if (verifySSL()) return AuthOutcome.FAILED; log.debug("AUTHENTICATED: was cached"); return handleRequest(); } return initiateLogin(); }
@Override public AuthOutcome handle(OnSessionCreated onCreateSession) { String header = facade.getRequest().getHeader(PAOS_HEADER); if (header != null) { return doHandle(new SamlInvocationContext(), onCreateSession); } else { try { MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(null, facade.getRequest().getInputStream()); SOAPBody soapBody = soapMessage.getSOAPBody(); Node authnRequestNode = soapBody.getFirstChild(); Document document = DocumentUtil.createDocument(); document.appendChild(document.importNode(authnRequestNode, true)); String samlResponse = PostBindingUtil.base64Encode(DocumentUtil.asString(document)); return doHandle(new SamlInvocationContext(null, samlResponse, null), onCreateSession); } catch (Exception e) { throw new RuntimeException("Error creating fault message.", e); } } }
@Override public AuthOutcome handle(OnSessionCreated onCreateSession) { return doHandle(new SamlInvocationContext(facade.getRequest().getFirstParam(GeneralConstants.SAML_REQUEST_KEY), facade.getRequest().getFirstParam(GeneralConstants.SAML_RESPONSE_KEY), facade.getRequest().getFirstParam(GeneralConstants.RELAY_STATE)), onCreateSession); }