Package org.jboss.seam.security.external.jaxb.samlv2.protocol

Examples of org.jboss.seam.security.external.jaxb.samlv2.protocol.ObjectFactory


    private StatusResponseType getSamlResponse(Document document) throws InvalidRequestException {
        try {
            Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
            @SuppressWarnings("unchecked")
            JAXBElement<StatusResponseType> jaxbResponseType = (JAXBElement<StatusResponseType>) unmarshaller.unmarshal(document);
            StatusResponseType statusResponse = jaxbResponseType.getValue();
            return statusResponse;
        } catch (JAXBException e) {
            throw new InvalidRequestException("SAML message could not be parsed", e);
        }
    }
View Full Code Here


    public void handleSucceededAuthentication(SamlIdpSession session, HttpServletResponse response) {
        sendAuthenticationResponse(samlDialogue.getExternalProvider(), session, false, response);
    }

    private void sendAuthenticationResponse(SamlExternalEntity serviceProvider, SamlIdpSession session, boolean failed, HttpServletResponse response) {
        StatusResponseType statusResponse;

        if (failed) {
            statusResponse = samlMessageFactory.createStatusResponse(SamlConstants.STATUS_RESPONDER, null);
        } else {
            SamlService service = serviceProvider.getService(SamlProfile.SINGLE_SIGN_ON);
View Full Code Here

    }

    private void finishSingleLogoutProcess(HttpServletResponse response) {
        boolean failed = samlIdpIncomingLogoutDialogue.get().isFailed();
        if (samlDialogue.get().getExternalProvider() != null) {
            StatusResponseType statusResponse = samlMessageFactory.createStatusResponse(failed ? SamlConstants.STATUS_RESPONDER : SamlConstants.STATUS_SUCCESS, null);
            samlMessageSender.sendResponse(samlDialogue.get().getExternalProvider(), statusResponse, SamlProfile.SINGLE_LOGOUT, response);
        } else {
            if (failed) {
                samlIdentityProviderSpi.get().globalLogoutFailed(responseHandler.createResponseHolder(response));
            } else {
View Full Code Here

      sendAuthenticationResponse(samlDialogue.getExternalProvider(), session, false, response);
   }

   private void sendAuthenticationResponse(SamlExternalEntity serviceProvider, SamlIdpSession session, boolean failed, HttpServletResponse response)
   {
      StatusResponseType statusResponse;

      if (failed)
      {
         statusResponse = samlMessageFactory.createStatusResponse(SamlConstants.STATUS_RESPONDER, null);
      }
View Full Code Here

   private void finishSingleLogoutProcess(HttpServletResponse response)
   {
      boolean failed = samlIdpIncomingLogoutDialogue.get().isFailed();
      if (samlDialogue.get().getExternalProvider() != null)
      {
         StatusResponseType statusResponse = samlMessageFactory.createStatusResponse(failed ? SamlConstants.STATUS_RESPONDER : SamlConstants.STATUS_SUCCESS, null);
         samlMessageSender.sendResponse(samlDialogue.get().getExternalProvider(), statusResponse, SamlProfile.SINGLE_LOGOUT, response);
      }
      else
      {
         if (failed)
View Full Code Here

      }

      Document document = getDocument(is);
      String issuerEntityId;
      RequestAbstractType samlRequestMessage = null;
      StatusResponseType samlResponseMessage = null;
      if (samlRequestOrResponse.isRequest())
      {
         samlRequestMessage = getSamlRequest(document);
         issuerEntityId = samlRequestMessage.getIssuer().getValue();
      }
      else
      {
         samlResponseMessage = getSamlResponse(document);
         issuerEntityId = samlResponseMessage.getIssuer().getValue();
      }
      log.debug("Received: " + SamlUtils.getDocumentAsString(document));

      try
      {
         if (samlRequestOrResponse.isRequest() || samlResponseMessage.getInResponseTo() == null)
         {
            // Request or unsolicited response

            String destination = samlRequestOrResponse.isRequest() ? samlRequestMessage.getDestination() : samlResponseMessage.getDestination();
            if (!samlEntityBean.get().getServiceURL(service).equals(destination))
            {
               throw new InvalidRequestException("Destination (" + destination + ") is not valid.");
            }

            dialogueManager.beginDialogue();
            samlDialogue.get().setExternalProviderMessageId(samlRequestOrResponse.isRequest() ? samlRequestMessage.getID() : samlResponseMessage.getID());
            SamlExternalEntity externalProvider = samlEntityBean.get().getExternalSamlEntityByEntityId(issuerEntityId);
            if (externalProvider == null)
            {
               throw new InvalidRequestException("Received message from unknown entity id " + issuerEntityId);
            }
            samlDialogue.get().setExternalProvider(externalProvider);
         }
         else
         {
            String dialogueId = samlResponseMessage.getInResponseTo();
            if (!dialogueManager.isExistingDialogue(dialogueId))
            {
               throw new InvalidRequestException("No request that corresponds with the received response");
            }
View Full Code Here

      try
      {
         Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
         @SuppressWarnings("unchecked")
         JAXBElement<StatusResponseType> jaxbResponseType = (JAXBElement<StatusResponseType>) unmarshaller.unmarshal(document);
         StatusResponseType statusResponse = jaxbResponseType.getValue();
         return statusResponse;
      }
      catch (JAXBException e)
      {
         throw new InvalidRequestException("SAML message could not be parsed", e);
View Full Code Here

            }
        }
    }

    public void processIDPResponse(HttpServletRequest httpRequest, HttpServletResponse httpResponse, StatusResponseType statusResponse) {
        StatusType status = statusResponse.getStatus();
        if (status.getStatusCode().getValue().equals(SamlConstants.STATUS_SUCCESS)) {
            samlServiceProviderSpi.get().globalLogoutSucceeded(responseHandler.createResponseHolder(httpResponse));
        } else {
            String statusCodeLevel1 = status.getStatusCode().getValue();
            String statusCodeLevel2 = null;
            if (status.getStatusCode().getStatusCode() != null) {
                statusCodeLevel2 = status.getStatusCode().getStatusCode().getValue();
            }
            samlServiceProviderSpi.get().globalLogoutFailed(statusCodeLevel1, statusCodeLevel2, responseHandler.createResponseHolder(httpResponse));
        }
        dialogue.setFinished(true);
    }
View Full Code Here

        response.setInResponseTo(samlDialogue.get().getExternalProviderMessageId());

        StatusCodeType statusCodeJaxb = objectFactory.createStatusCodeType();
        statusCodeJaxb.setValue(statusCode);

        StatusType statusType = objectFactory.createStatusType();
        statusType.setStatusCode(statusCodeJaxb);
        if (statusMessage != null) {
            statusType.setStatusMessage(statusMessage);
        }

        response.setStatus(statusType);
    }
View Full Code Here

    private ResponseHandler responseHandler;

    public void processIDPResponse(HttpServletRequest httpRequest, HttpServletResponse httpResponse, StatusResponseType statusResponse) throws InvalidRequestException {
        SamlExternalIdentityProvider idp = (SamlExternalIdentityProvider) samlDialogue.getExternalProvider();

        StatusType status = statusResponse.getStatus();
        if (status == null) {
            throw new InvalidRequestException("Response does not contain a status");
        }

        String statusValue = status.getStatusCode().getValue();
        if (!SamlConstants.STATUS_SUCCESS.equals(statusValue)) {
            String statusCodeLevel1 = statusValue;
            String statusCodeLevel2 = null;
            if (status.getStatusCode().getStatusCode() != null) {
                statusCodeLevel2 = status.getStatusCode().getStatusCode().getValue();
            }
            samlServiceProviderSpi.get().loginFailed(statusCodeLevel1, statusCodeLevel2, responseHandler.createResponseHolder(httpResponse));
        }

        if (!(statusResponse instanceof ResponseType)) {
View Full Code Here

TOP

Related Classes of org.jboss.seam.security.external.jaxb.samlv2.protocol.ObjectFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.