Search in sources :

Example 71 with NameID

use of com.sun.identity.saml2.assertion.NameID in project OpenAM by OpenRock.

the class DefaultAccountMapper method getSearchParameters.

/**
     * Returns the <code>NameIDInfoKey</code> key value pair that can
     * be used for searching the user.
     * @param nameID <code>NameID</code> object.
     * @param hostEntityID hosted <code>EntityID</code>.
     * @param remoteEntityID remote <code>EntityID</code>.
     * @exception <code>WSFederationException</code> if any failure.
     */
protected Map getSearchParameters(NameIdentifier nameID, String realm, String hostEntityID, String remoteEntityID) throws WSFederationException {
    if (nameID == null) {
        throw new WSFederationException(bundle.getString("nullNameID"));
    }
    NameIDInfoKey infoKey = null;
    try {
        infoKey = new NameIDInfoKey(nameID.getName(), hostEntityID, remoteEntityID);
    } catch (SAML2Exception se) {
        throw new WSFederationException(se);
    }
    HashSet set = new HashSet();
    set.add(infoKey.toValueString());
    Map keyMap = new HashMap();
    keyMap.put(AccountUtils.getNameIDInfoKeyAttribute(), set);
    if (debug.messageEnabled()) {
        debug.message("DefaultAccountMapper.getNameIDKeyMap: " + keyMap);
    }
    return keyMap;
}
Also used : SAML2Exception(com.sun.identity.saml2.common.SAML2Exception) WSFederationException(com.sun.identity.wsfederation.common.WSFederationException) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map) NameIDInfoKey(com.sun.identity.saml2.common.NameIDInfoKey) HashSet(java.util.HashSet)

Example 72 with NameID

use of com.sun.identity.saml2.assertion.NameID in project OpenAM by OpenRock.

the class DefaultSubjectProvider method createNameIdentifier.

private NameID createNameIdentifier(String subjectId, String nameIdFormat) throws TokenCreationException {
    NameID nameID = AssertionFactory.getInstance().createNameID();
    try {
        nameID.setValue(subjectId);
        nameID.setFormat(nameIdFormat);
    } catch (SAML2Exception e) {
        throw new TokenCreationException(ResourceException.INTERNAL_ERROR, "Exception caught setting NameID state in DefaultSubjectProvider: " + e, e);
    }
    return nameID;
}
Also used : SAML2Exception(com.sun.identity.saml2.common.SAML2Exception) NameID(com.sun.identity.saml2.assertion.NameID) TokenCreationException(org.forgerock.openam.sts.TokenCreationException)

Aggregations

SAML2Exception (com.sun.identity.saml2.common.SAML2Exception)46 NameID (com.sun.identity.saml2.assertion.NameID)33 List (java.util.List)25 ArrayList (java.util.ArrayList)22 EncryptedID (com.sun.identity.saml2.assertion.EncryptedID)18 SAML2MetaException (com.sun.identity.saml2.meta.SAML2MetaException)15 HashMap (java.util.HashMap)14 SessionException (com.sun.identity.plugin.session.SessionException)12 NameIDInfo (com.sun.identity.saml2.common.NameIDInfo)12 Map (java.util.Map)11 Subject (com.sun.identity.saml2.assertion.Subject)10 SPSSODescriptorElement (com.sun.identity.saml2.jaxb.metadata.SPSSODescriptorElement)10 Element (org.w3c.dom.Element)10 Date (java.util.Date)9 Iterator (java.util.Iterator)9 AssertionFactory (com.sun.identity.saml2.assertion.AssertionFactory)8 SAML2MetaManager (com.sun.identity.saml2.meta.SAML2MetaManager)8 Assertion (com.sun.identity.saml2.assertion.Assertion)7 Issuer (com.sun.identity.saml2.assertion.Issuer)7 IDPSSODescriptorElement (com.sun.identity.saml2.jaxb.metadata.IDPSSODescriptorElement)7