Search in sources :

Example 11 with ManageNameIDServiceElement

use of com.sun.identity.saml2.jaxb.metadata.ManageNameIDServiceElement in project OpenAM by OpenRock.

the class DoManageNameID method getSPManageNameIDConfig.

/**
     * Returns first ManageNameID configuration in an entity under
     * the realm.
     * @param realm The realm under which the entity resides.
     * @param entityId ID of the entity to be retrieved.
     * @param binding bind type need to has to be matched.
     * @return <code>ManageNameIDServiceElement</code> for the entity or null
     * @throws SAML2MetaException if unable to retrieve the first identity
     *                            provider's SSO configuration.
     * @throws SessionException invalid or expired single-sign-on session.
     */
public static ManageNameIDServiceElement getSPManageNameIDConfig(String realm, String entityId, String binding) throws SAML2MetaException, SessionException {
    ManageNameIDServiceElement mni = null;
    SPSSODescriptorElement spSSODesc = metaManager.getSPSSODescriptor(realm, entityId);
    if (spSSODesc == null) {
        return null;
    }
    List list = spSSODesc.getManageNameIDService();
    if ((list != null) && !list.isEmpty()) {
        if (binding == null) {
            return (ManageNameIDServiceElement) list.get(0);
        }
        Iterator it = list.iterator();
        while (it.hasNext()) {
            mni = (ManageNameIDServiceElement) it.next();
            if (binding.equalsIgnoreCase(mni.getBinding())) {
                break;
            }
        }
    }
    return mni;
}
Also used : ManageNameIDServiceElement(com.sun.identity.saml2.jaxb.metadata.ManageNameIDServiceElement) SPSSODescriptorElement(com.sun.identity.saml2.jaxb.metadata.SPSSODescriptorElement) Iterator(java.util.Iterator) List(java.util.List)

Example 12 with ManageNameIDServiceElement

use of com.sun.identity.saml2.jaxb.metadata.ManageNameIDServiceElement in project OpenAM by OpenRock.

the class SAMLv2ModelImpl method saveSPsoapMni.

/**
     * Saves the Soap ManageNameID Service for SP.
     *
     * @param mnisoapLocation is the location url.
     * @param mnirespLoaction is the response location url.
     * @param manageNameIdList the live list to be updated.
     * @param objFact the Object Factory class.
     * @throws JAXBException if save fails.
     */
private void saveSPsoapMni(String mnisoapLocation, String mnirespLoaction, List manageNameIdList, com.sun.identity.saml2.jaxb.metadata.ObjectFactory objFact) throws JAXBException {
    if (mnisoapLocation != null && mnisoapLocation.length() > 0) {
        ManageNameIDServiceElement slsElemSoap = objFact.createManageNameIDServiceElement();
        slsElemSoap.setBinding(soapBinding);
        slsElemSoap.setLocation(mnisoapLocation);
        slsElemSoap.setResponseLocation(mnirespLoaction);
        manageNameIdList.add(slsElemSoap);
    }
}
Also used : ManageNameIDServiceElement(com.sun.identity.saml2.jaxb.metadata.ManageNameIDServiceElement)

Example 13 with ManageNameIDServiceElement

use of com.sun.identity.saml2.jaxb.metadata.ManageNameIDServiceElement in project OpenAM by OpenRock.

the class SAMLv2ModelImpl method savepostMni.

/**
     * Saves the Post ManageNameID Service.
     *
     * @param mnipostLocation is the location url.
     * @param mnipostRespLocation is the response location url.
     * @param manageNameIdList the live list to be updated.
     * @param objFact the Object Factory class.
     * @throws JAXBException if save fails.
     */
private void savepostMni(String mnipostLocation, String mnipostRespLocation, List manageNameIdList, com.sun.identity.saml2.jaxb.metadata.ObjectFactory objFact) throws JAXBException {
    if (mnipostLocation != null && mnipostLocation.length() > 0) {
        ManageNameIDServiceElement slsElemPost = objFact.createManageNameIDServiceElement();
        slsElemPost.setBinding(httpPostBinding);
        slsElemPost.setLocation(mnipostLocation);
        slsElemPost.setResponseLocation(mnipostRespLocation);
        manageNameIdList.add(slsElemPost);
    }
}
Also used : ManageNameIDServiceElement(com.sun.identity.saml2.jaxb.metadata.ManageNameIDServiceElement)

Example 14 with ManageNameIDServiceElement

use of com.sun.identity.saml2.jaxb.metadata.ManageNameIDServiceElement in project OpenAM by OpenRock.

the class NameIDMapping method getNameIDMappingService.

/**
     * Returns first NameIDMappingService matching specified binding in an
     * entity under the realm.
     *
     * @param realm The realm under which the entity resides.
     * @param entityId ID of the entity to be retrieved.
     * @param binding bind type need to has to be matched.
     * @return <code>ManageNameIDServiceElement</code> for the entity or null
     * @throws SAML2MetaException if unable to retrieve the first identity
     *     provider's SSO configuration.
     * @throws SessionException invalid or expired single-sign-on session
     */
public static NameIDMappingServiceElement getNameIDMappingService(String realm, String entityId, String binding) throws SAML2MetaException {
    IDPSSODescriptorElement idpSSODesc = metaManager.getIDPSSODescriptor(realm, entityId);
    if (idpSSODesc == null) {
        SAML2Utils.debug.error(SAML2Utils.bundle.getString("noIDPEntry"));
        return null;
    }
    List list = idpSSODesc.getNameIDMappingService();
    NameIDMappingServiceElement nimService = null;
    if ((list != null) && !list.isEmpty()) {
        if (binding == null) {
            return (NameIDMappingServiceElement) list.get(0);
        }
        Iterator it = list.iterator();
        while (it.hasNext()) {
            nimService = (NameIDMappingServiceElement) it.next();
            if (binding.equalsIgnoreCase(nimService.getBinding())) {
                return nimService;
            }
        }
    }
    return null;
}
Also used : NameIDMappingServiceElement(com.sun.identity.saml2.jaxb.metadata.NameIDMappingServiceElement) Iterator(java.util.Iterator) List(java.util.List) IDPSSODescriptorElement(com.sun.identity.saml2.jaxb.metadata.IDPSSODescriptorElement)

Aggregations

ManageNameIDServiceElement (com.sun.identity.saml2.jaxb.metadata.ManageNameIDServiceElement)13 SAML2Exception (com.sun.identity.saml2.common.SAML2Exception)5 SAML2MetaException (com.sun.identity.saml2.meta.SAML2MetaException)5 List (java.util.List)5 SessionException (com.sun.identity.plugin.session.SessionException)3 IDPSSODescriptorElement (com.sun.identity.saml2.jaxb.metadata.IDPSSODescriptorElement)3 ManageNameIDRequest (com.sun.identity.saml2.protocol.ManageNameIDRequest)3 Iterator (java.util.Iterator)3 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)2 NameIDMappingServiceElement (com.sun.identity.saml2.jaxb.metadata.NameIDMappingServiceElement)2 SPSSODescriptorElement (com.sun.identity.saml2.jaxb.metadata.SPSSODescriptorElement)2 SingleLogoutServiceElement (com.sun.identity.saml2.jaxb.metadata.SingleLogoutServiceElement)2 SAML2MetaManager (com.sun.identity.saml2.meta.SAML2MetaManager)2 ManageNameIDResponse (com.sun.identity.saml2.protocol.ManageNameIDResponse)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 BaseConfigType (com.sun.identity.saml2.jaxb.entityconfig.BaseConfigType)1 ArtifactResolutionServiceElement (com.sun.identity.saml2.jaxb.metadata.ArtifactResolutionServiceElement)1