Search in sources :

Example 6 with BaseConfigType

use of com.sun.identity.saml2.jaxb.entityconfig.BaseConfigType in project OpenAM by OpenRock.

the class SAMLv2ModelImpl method getExtendedServiceProviderAttributes.

/**
     * Returns a map with extended service provider attributes and values.
     *
     * @param realm to which the entity belongs.
     * @param entityName is the entity id.
     * @return Map with extended attribute values of Service Provider.
     * @throws AMConsoleException if unable to retrieve the Service Provider
     *     attrubutes based on the realm and entityName passed.
     */
public Map getExtendedServiceProviderAttributes(String realm, String entityName) throws AMConsoleException {
    String[] params = { realm, entityName, "SAMLv2", "SP-Extended" };
    logEvent("ATTEMPT_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", params);
    Map map = null;
    SPSSOConfigElement spssoConfig = null;
    try {
        SAML2MetaManager samlManager = getSAML2MetaManager();
        spssoConfig = samlManager.getSPSSOConfig(realm, entityName);
        if (spssoConfig != null) {
            BaseConfigType baseConfig = (BaseConfigType) spssoConfig;
            map = SAML2MetaUtils.getAttributes(baseConfig);
        }
        logEvent("SUCCEED_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", params);
    } catch (SAML2MetaException e) {
        debug.warning("SAMLv2ModelImpl.getExtendedServiceProviderAttributes:", e);
        String strError = getErrorString(e);
        String[] paramsEx = { realm, entityName, "SAMLv2", "SP-Extended", strError };
        logEvent("FEDERATION_EXCEPTION_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", paramsEx);
        throw new AMConsoleException(strError);
    }
    return (map != null) ? map : Collections.EMPTY_MAP;
}
Also used : BaseConfigType(com.sun.identity.saml2.jaxb.entityconfig.BaseConfigType) SPSSOConfigElement(com.sun.identity.saml2.jaxb.entityconfig.SPSSOConfigElement) SAML2MetaManager(com.sun.identity.saml2.meta.SAML2MetaManager) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) HashMap(java.util.HashMap) SAML2MetaException(com.sun.identity.saml2.meta.SAML2MetaException)

Example 7 with BaseConfigType

use of com.sun.identity.saml2.jaxb.entityconfig.BaseConfigType in project OpenAM by OpenRock.

the class SAMLv2ModelImpl method getExtendedAttrQueryAttributes.

/**
     * Returns a map with extended AttrQuery attributes and values.
     *
     * @param realm to which the entity belongs.
     * @param entityName is the entity id.
     * @return Map with extended AttrQuery values.
     * @throws AMConsoleException if unable to retrieve ext AttrQuery
     *     attributes based on the realm and entityName passed.
     */
public Map getExtendedAttrQueryAttributes(String realm, String entityName) throws AMConsoleException {
    String[] params = { realm, entityName, "SAMLv2", "AttrQuery-Ext" };
    logEvent("ATTEMPT_GET_ATTR_QUERY_ATTR_VALUES", params);
    Map map = null;
    AttributeQueryConfigElement attrQueryConfig = null;
    try {
        SAML2MetaManager samlManager = getSAML2MetaManager();
        attrQueryConfig = samlManager.getAttributeQueryConfig(realm, entityName);
        if (attrQueryConfig != null) {
            BaseConfigType baseConfig = (BaseConfigType) attrQueryConfig;
            map = SAML2MetaUtils.getAttributes(baseConfig);
        }
        logEvent("SUCCEED_GET_ATTR_QUERY_ATTR_VALUES", params);
    } catch (SAML2MetaException e) {
        debug.warning("SAMLv2ModelImpl.getExtendedAttrQueryAttributes:", e);
        String strError = getErrorString(e);
        String[] paramsEx = { realm, entityName, "SAMLv2", "AttrQuery-Ext", strError };
        logEvent("FEDERATION_EXCEPTION_GET_ATTR_QUERY_ATTR_VALUES", paramsEx);
        throw new AMConsoleException(strError);
    }
    return (map != null) ? map : Collections.EMPTY_MAP;
}
Also used : BaseConfigType(com.sun.identity.saml2.jaxb.entityconfig.BaseConfigType) SAML2MetaManager(com.sun.identity.saml2.meta.SAML2MetaManager) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) HashMap(java.util.HashMap) AttributeQueryConfigElement(com.sun.identity.saml2.jaxb.entityconfig.AttributeQueryConfigElement) SAML2MetaException(com.sun.identity.saml2.meta.SAML2MetaException)

Example 8 with BaseConfigType

use of com.sun.identity.saml2.jaxb.entityconfig.BaseConfigType in project OpenAM by OpenRock.

the class SAMLv2ModelImpl method getExtendedAffiliationyAttributes.

/**
     * Returns a map with extended Affiliation attributes and values.
     *
     * @param realm to which the entity belongs.
     * @param entityName is the entity id.
     * @return Map with extended Affiliation values.
     * @throws AMConsoleException if unable to retrieve ext Affiliation
     *     attributes based on the realm and entityName passed.
     */
public Map getExtendedAffiliationyAttributes(String realm, String entityName) throws AMConsoleException {
    ;
    String[] params = { realm, entityName, "SAMLv2", "Affiliation-Ext" };
    logEvent("ATTEMPT_GET_AFFILIATION_ATTR_VALUES", params);
    Map map = null;
    AffiliationConfigElement atffilConfig = null;
    try {
        SAML2MetaManager samlManager = getSAML2MetaManager();
        atffilConfig = samlManager.getAffiliationConfig(realm, entityName);
        if (atffilConfig != null) {
            BaseConfigType baseConfig = (BaseConfigType) atffilConfig;
            map = SAML2MetaUtils.getAttributes(baseConfig);
            Iterator it = map.entrySet().iterator();
            while (it.hasNext()) {
                Map.Entry pairs = (Map.Entry) it.next();
            }
            String metalias = baseConfig.getMetaAlias();
            List list = new ArrayList();
            list.add(metalias);
            map.put("metaAlias", list);
        }
        logEvent("SUCCEED_GET_AFFILIATION_ATTR_VALUES", params);
    } catch (SAML2MetaException e) {
        debug.warning("SAMLv2ModelImpl.getExtendedAffiliationyAttributes:", e);
        String strError = getErrorString(e);
        String[] paramsEx = { realm, entityName, "SAMLv2", "Affiliation-Ext", strError };
        logEvent("FEDERATION_EXCEPTION_GET_AFFILIATION_ATTR_VALUES", paramsEx);
        throw new AMConsoleException(strError);
    }
    return (map != null) ? map : Collections.EMPTY_MAP;
}
Also used : ArrayList(java.util.ArrayList) SAML2MetaManager(com.sun.identity.saml2.meta.SAML2MetaManager) BaseConfigType(com.sun.identity.saml2.jaxb.entityconfig.BaseConfigType) AffiliationConfigElement(com.sun.identity.saml2.jaxb.entityconfig.AffiliationConfigElement) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) HashMap(java.util.HashMap) SAML2MetaException(com.sun.identity.saml2.meta.SAML2MetaException)

Example 9 with BaseConfigType

use of com.sun.identity.saml2.jaxb.entityconfig.BaseConfigType in project OpenAM by OpenRock.

the class SAMLv2ModelImpl method getExtendedAuthnAuthorityAttributes.

/**
     * Returns a map with extended AuthnAuthority attributes and values.
     *
     * @param realm to which the entity belongs.
     * @param entityName is the entity id.
     * @return Map with extended AuthnAuthority values.
     * @throws AMConsoleException if unable to retrieve ext AuthnAuthority
     *     attributes based on the realm and entityName passed.
     */
public Map getExtendedAuthnAuthorityAttributes(String realm, String entityName) throws AMConsoleException {
    String[] params = { realm, entityName, "SAMLv2", "AuthnAuthority-Ext" };
    logEvent("ATTEMPT_GET_AUTHN_AUTH_ATTR_VALUES", params);
    Map map = null;
    AuthnAuthorityConfigElement authnAuthorityConfig = null;
    try {
        SAML2MetaManager samlManager = getSAML2MetaManager();
        authnAuthorityConfig = samlManager.getAuthnAuthorityConfig(realm, entityName);
        if (authnAuthorityConfig != null) {
            BaseConfigType baseConfig = (BaseConfigType) authnAuthorityConfig;
            map = SAML2MetaUtils.getAttributes(baseConfig);
        }
        logEvent("SUCCEED_GET_AUTHN_AUTH_ATTR_VALUES", params);
    } catch (SAML2MetaException e) {
        debug.warning("SAMLv2ModelImpl.getExtendedAuthnAuthorityAttributes:", e);
        String strError = getErrorString(e);
        String[] paramsEx = { realm, entityName, "SAMLv2", "AuthnAuthority-Ext", strError };
        logEvent("FEDERATION_EXCEPTION_GET_AUTHN_AUTH_ATTR_VALUES", paramsEx);
        throw new AMConsoleException(strError);
    }
    return (map != null) ? map : Collections.EMPTY_MAP;
}
Also used : BaseConfigType(com.sun.identity.saml2.jaxb.entityconfig.BaseConfigType) SAML2MetaManager(com.sun.identity.saml2.meta.SAML2MetaManager) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) HashMap(java.util.HashMap) AuthnAuthorityConfigElement(com.sun.identity.saml2.jaxb.entityconfig.AuthnAuthorityConfigElement) SAML2MetaException(com.sun.identity.saml2.meta.SAML2MetaException)

Example 10 with BaseConfigType

use of com.sun.identity.saml2.jaxb.entityconfig.BaseConfigType in project OpenAM by OpenRock.

the class TaskModelImpl method getConfigureGoogleAppsURLs.

public Map getConfigureGoogleAppsURLs(String realm, String entityId) throws AMConsoleException {
    Map map = new HashMap();
    IDPSSODescriptorElement idpssoDescriptor = null;
    try {
        SAML2MetaManager samlManager = new SAML2MetaManager();
        idpssoDescriptor = samlManager.getIDPSSODescriptor(realm, entityId);
        String signinPageURL = null;
        if (idpssoDescriptor != null) {
            List signonList = idpssoDescriptor.getSingleSignOnService();
            for (int i = 0; i < signonList.size(); i++) {
                SingleSignOnServiceElement signElem = (SingleSignOnServiceElement) signonList.get(i);
                String tmp = signElem.getBinding();
                if (tmp.contains("HTTP-Redirect")) {
                    signinPageURL = signElem.getLocation();
                    map.put("SigninPageURL", returnEmptySetIfValueIsNull(signinPageURL));
                }
            }
        }
        URL aURL = new URL(signinPageURL);
        String signoutPageURL = null;
        String protocol = aURL.getProtocol();
        String host = aURL.getHost();
        int port = aURL.getPort();
        if (port == -1) {
            port = (aURL.getProtocol().equals("https")) ? 443 : 80;
        }
        String deploymentURI = SystemPropertiesManager.get(Constants.AM_SERVICES_DEPLOYMENT_DESCRIPTOR);
        String url = protocol + "://" + host + ":" + port + deploymentURI;
        signoutPageURL = url + "/UI/Logout?goto=" + url;
        map.put("SignoutPageURL", returnEmptySetIfValueIsNull(signoutPageURL));
        map.put("ChangePasswordURL", returnEmptySetIfValueIsNull(url + "/idm/EndUser"));
        // get pubkey                 
        Map extValueMap = new HashMap();
        IDPSSOConfigElement idpssoConfig = samlManager.getIDPSSOConfig(realm, entityId);
        if (idpssoConfig != null) {
            BaseConfigType baseConfig = (BaseConfigType) idpssoConfig;
            extValueMap = SAML2MetaUtils.getAttributes(baseConfig);
        }
        List aList = (List) extValueMap.get("signingCertAlias");
        String signingCertAlias = null;
        if (aList != null) {
            signingCertAlias = (String) aList.get(0);
        }
        String publickey = SAML2MetaSecurityUtils.buildX509Certificate(signingCertAlias);
        String str = "-----BEGIN CERTIFICATE-----\n" + publickey + "-----END CERTIFICATE-----\n";
        map.put("PubKey", returnEmptySetIfValueIsNull(str));
    } catch (SAML2MetaException ex) {
        throw new AMConsoleException(ex.getMessage());
    } catch (MalformedURLException ex) {
        throw new AMConsoleException(ex.getMessage());
    }
    return map;
}
Also used : MalformedURLException(java.net.MalformedURLException) HashMap(java.util.HashMap) IDPSSOConfigElement(com.sun.identity.saml2.jaxb.entityconfig.IDPSSOConfigElement) SAML2MetaManager(com.sun.identity.saml2.meta.SAML2MetaManager) SingleSignOnServiceElement(com.sun.identity.saml2.jaxb.metadata.SingleSignOnServiceElement) URL(java.net.URL) BaseConfigType(com.sun.identity.saml2.jaxb.entityconfig.BaseConfigType) List(java.util.List) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map) SAML2MetaException(com.sun.identity.saml2.meta.SAML2MetaException) IDPSSODescriptorElement(com.sun.identity.saml2.jaxb.metadata.IDPSSODescriptorElement)

Aggregations

BaseConfigType (com.sun.identity.saml2.jaxb.entityconfig.BaseConfigType)36 List (java.util.List)31 SAML2MetaException (com.sun.identity.saml2.meta.SAML2MetaException)25 ArrayList (java.util.ArrayList)17 SAML2MetaManager (com.sun.identity.saml2.meta.SAML2MetaManager)16 Iterator (java.util.Iterator)15 HashMap (java.util.HashMap)14 Map (java.util.Map)14 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)12 EntityConfigElement (com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement)11 SAML2Exception (com.sun.identity.saml2.common.SAML2Exception)10 SessionException (com.sun.identity.plugin.session.SessionException)7 AttributeType (com.sun.identity.saml2.jaxb.entityconfig.AttributeType)5 ConfigurationException (com.sun.identity.plugin.configuration.ConfigurationException)4 AffiliationConfigElement (com.sun.identity.saml2.jaxb.entityconfig.AffiliationConfigElement)4 IDPSSOConfigElement (com.sun.identity.saml2.jaxb.entityconfig.IDPSSOConfigElement)4 ObjectFactory (com.sun.identity.saml2.jaxb.entityconfig.ObjectFactory)4 EntityDescriptorElement (com.sun.identity.saml2.jaxb.metadata.EntityDescriptorElement)4 IDPSSODescriptorElement (com.sun.identity.saml2.jaxb.metadata.IDPSSODescriptorElement)4 SessionProvider (com.sun.identity.plugin.session.SessionProvider)3