Search in sources :

Example 11 with AssertionArtifact

use of com.sun.identity.saml.protocol.AssertionArtifact in project OpenAM by OpenRock.

the class SAMLAwareServlet method createArtifact.

/**
     * Creates a list of AssertionArtifact's id.
     *
     * @param sso the user Session object
     * @param target A String representing the target host
     * @param targetUrl A URL String representing the target site
     * @param version The relying party preferred Assertion version number
     * @return a List representing a list of AssertionArtifact's id
     * @throws SAMLException if there is an error.
     */
private List createArtifact(Object sso, String target, HttpServletRequest request, HttpServletResponse response, String targetUrl, String version) throws SAMLException {
    if (sso == null || target == null || target.length() == 0 || version == null || version.length() == 0) {
        throw new SAMLException(SAMLUtils.bundle.getString("createArtifactError"));
    }
    List artifactList = new ArrayList();
    AssertionManager assertManager = AssertionManager.getInstance();
    try {
        SessionProvider sessionProvider = SessionManager.getProvider();
        AssertionArtifact artifact = assertManager.createAssertionArtifact(sessionProvider.getSessionID(sso), target, request, response, targetUrl, version);
        if (SAMLUtils.debug.messageEnabled()) {
            SAMLUtils.debug.message("AssertionArtifact id = " + artifact.toString());
        }
        String artid = artifact.getAssertionArtifact();
        artifactList.add(artid);
    } catch (SessionException se) {
        SAMLUtils.debug.error("Couldn't get SessionProvider.");
        throw new SAMLException(SAMLUtils.bundle.getString("nullSessionProvider"));
    }
    return artifactList;
}
Also used : AssertionManager(com.sun.identity.saml.AssertionManager) ArrayList(java.util.ArrayList) SessionException(com.sun.identity.plugin.session.SessionException) ArrayList(java.util.ArrayList) List(java.util.List) SAMLException(com.sun.identity.saml.common.SAMLException) AssertionArtifact(com.sun.identity.saml.protocol.AssertionArtifact) SessionProvider(com.sun.identity.plugin.session.SessionProvider)

Aggregations

AssertionArtifact (com.sun.identity.saml.protocol.AssertionArtifact)11 SAMLException (com.sun.identity.saml.common.SAMLException)7 SessionException (com.sun.identity.plugin.session.SessionException)6 Assertion (com.sun.identity.saml.assertion.Assertion)6 FSException (com.sun.identity.federation.common.FSException)5 FSAssertionArtifact (com.sun.identity.federation.message.FSAssertionArtifact)5 ArrayList (java.util.ArrayList)5 List (java.util.List)5 FSAssertionManager (com.sun.identity.federation.services.FSAssertionManager)3 Status (com.sun.identity.saml.protocol.Status)3 AssertionManager (com.sun.identity.saml.AssertionManager)2 SAMLResponderException (com.sun.identity.saml.common.SAMLResponderException)2 StatusCode (com.sun.identity.saml.protocol.StatusCode)2 FSRemoteException (com.sun.identity.federation.common.FSRemoteException)1 FSAssertion (com.sun.identity.federation.message.FSAssertion)1 FSResponse (com.sun.identity.federation.message.FSResponse)1 FSMsgException (com.sun.identity.federation.message.common.FSMsgException)1 IDFFMetaException (com.sun.identity.federation.meta.IDFFMetaException)1 SessionProvider (com.sun.identity.plugin.session.SessionProvider)1 AssertionIDReference (com.sun.identity.saml.assertion.AssertionIDReference)1