Search in sources :

Example 6 with TokenIssuerEndpointElement

use of com.sun.identity.wsfederation.jaxb.wsfederation.TokenIssuerEndpointElement in project OpenAM by OpenRock.

the class WSFedPropertiesModelImpl method setGenAttributeValues.

/**
     * Saves the attribute values from the General page.
     *
     * @param realm to which the entity belongs.
     * @param fedId is the entity id.
     * @param idpStdValues has the General standard attribute value pairs.
     * @param role of the entity ID.
     * @param location specifies if the entity is remote or local.
     * @throws AMConsoleException if saving of attribute value fails.
     */
public void setGenAttributeValues(String realm, String fedId, Map idpStdValues, String role, String location) throws AMConsoleException {
    String tknissEndPt = null;
    String tknissName = null;
    Iterator it = idpStdValues.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry entry = (Map.Entry) it.next();
        Object key = entry.getKey();
        Object value = entry.getValue();
        if (key.equals(TFTOKENISSUER_ENDPT)) {
            HashSet set = (HashSet) idpStdValues.get(key);
            Iterator i = set.iterator();
            while ((i != null) && (i.hasNext())) {
                tknissEndPt = (String) i.next();
            }
        } else if (key.equals(TFTOKENISSUER_NAME)) {
            HashSet set = (HashSet) idpStdValues.get(key);
            Iterator i = set.iterator();
            while ((i != null) && (i.hasNext())) {
                tknissName = (String) i.next();
            }
        } else if (key.equals(TF_DISPNAME)) {
            if (role.equals(EntityModel.SERVICE_PROVIDER)) {
                HashSet set = (HashSet) idpStdValues.get(key);
                // Get the current map of extended SP values
                Map tmpMap = getExtendedValues(role, realm, fedId);
                // Replace existing value
                tmpMap.put(TF_DISPNAME, set);
                setSPExtAttributeValues(realm, fedId, tmpMap, location);
            } else if (role.equals(EntityModel.IDENTITY_PROVIDER)) {
                HashSet set = (HashSet) idpStdValues.get(key);
                // Get the current map of extended IDP values
                Map tmpMap = getExtendedValues(role, realm, fedId);
                // Replace existing value
                tmpMap.put(TF_DISPNAME, set);
                setIDPExtAttributeValues(realm, fedId, tmpMap, location);
            } else if (role.equals(DUAL)) {
                HashSet set = (HashSet) idpStdValues.get(key);
                // Get the current map of extended SP values
                Map tmpMap = getExtendedValues(EntityModel.SERVICE_PROVIDER, realm, fedId);
                // Replace existing value
                tmpMap.put(TF_DISPNAME, set);
                setSPExtAttributeValues(realm, fedId, tmpMap, location);
                // Get the current map of extended IDP values
                tmpMap = getExtendedValues(EntityModel.IDENTITY_PROVIDER, realm, fedId);
                set = (HashSet) idpStdValues.get(TFIDPDISP_NAME);
                // Replace existing value
                tmpMap.put(TF_DISPNAME, set);
                setIDPExtAttributeValues(realm, fedId, tmpMap, location);
            }
        }
    }
    try {
        //fedElem is standard metadata federation element under the realm.
        WSFederationMetaManager metaManager = getWSFederationMetaManager();
        FederationElement fedElem = metaManager.getEntityDescriptor(realm, fedId);
        if (fedElem == null) {
            if (debug.warningEnabled()) {
                debug.warning("WSFedPropertiesModelImpl.setGenAttributeValues:" + " found invalid  federation element " + fedId);
            }
            throw new AMConsoleException("invalid.federation.element");
        } else {
            for (Iterator iter = fedElem.getAny().iterator(); iter.hasNext(); ) {
                Object o = iter.next();
                if (o instanceof TokenIssuerEndpointElement) {
                    ((TokenIssuerEndpointElement) o).getAddress().setValue(tknissEndPt);
                } else if (o instanceof TokenIssuerNameElement) {
                    ((TokenIssuerNameElement) o).setValue(tknissName);
                }
            }
            metaManager.setFederation(realm, fedElem);
        }
    } catch (WSFederationMetaException e) {
        debug.warning("WSFedPropertiesModelImpl.setGenAttributeValues", e);
        throw new AMConsoleException(e.getMessage());
    }
}
Also used : WSFederationMetaManager(com.sun.identity.wsfederation.meta.WSFederationMetaManager) TokenIssuerEndpointElement(com.sun.identity.wsfederation.jaxb.wsfederation.TokenIssuerEndpointElement) TokenIssuerNameElement(com.sun.identity.wsfederation.jaxb.wsfederation.TokenIssuerNameElement) Iterator(java.util.Iterator) WSFederationMetaException(com.sun.identity.wsfederation.meta.WSFederationMetaException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map) FederationElement(com.sun.identity.wsfederation.jaxb.wsfederation.FederationElement) HashSet(java.util.HashSet)

Example 7 with TokenIssuerEndpointElement

use of com.sun.identity.wsfederation.jaxb.wsfederation.TokenIssuerEndpointElement in project OpenAM by OpenRock.

the class WSFedPropertiesModelImpl method isDualRole.

/**
     * Retrieves a count of the TokenIssuerEndpointElement
     *     which would help in determining whether dual role or not.
     * @param edes is the standard metadata object.
     *
     * @return count of the TokenIssuerEndpointElement
     */
private boolean isDualRole(FederationElement edes) {
    int cnt = 0;
    boolean dual = false;
    if (edes != null) {
        for (Iterator iter = edes.getAny().iterator(); iter.hasNext(); ) {
            Object o = iter.next();
            if (o instanceof TokenIssuerEndpointElement) {
                cnt++;
            }
        }
    }
    if (cnt > 1) {
        dual = true;
    }
    return dual;
}
Also used : Iterator(java.util.Iterator) TokenIssuerEndpointElement(com.sun.identity.wsfederation.jaxb.wsfederation.TokenIssuerEndpointElement)

Aggregations

TokenIssuerEndpointElement (com.sun.identity.wsfederation.jaxb.wsfederation.TokenIssuerEndpointElement)7 FederationElement (com.sun.identity.wsfederation.jaxb.wsfederation.FederationElement)4 WSFederationMetaManager (com.sun.identity.wsfederation.meta.WSFederationMetaManager)4 Iterator (java.util.Iterator)4 TokenIssuerNameElement (com.sun.identity.wsfederation.jaxb.wsfederation.TokenIssuerNameElement)3 UriNamedClaimTypesOfferedElement (com.sun.identity.wsfederation.jaxb.wsfederation.UriNamedClaimTypesOfferedElement)3 WSFederationMetaException (com.sun.identity.wsfederation.meta.WSFederationMetaException)3 AttributedURIType (com.sun.identity.wsfederation.jaxb.wsaddr.AttributedURIType)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)1 ClaimType (com.sun.identity.wsfederation.jaxb.wsfederation.ClaimType)1 DisplayNameType (com.sun.identity.wsfederation.jaxb.wsfederation.DisplayNameType)1 SingleSignOutNotificationEndpointElement (com.sun.identity.wsfederation.jaxb.wsfederation.SingleSignOutNotificationEndpointElement)1 TokenSigningKeyInfoElement (com.sun.identity.wsfederation.jaxb.wsfederation.TokenSigningKeyInfoElement)1 TokenType (com.sun.identity.wsfederation.jaxb.wsfederation.TokenType)1 TokenTypesOfferedElement (com.sun.identity.wsfederation.jaxb.wsfederation.TokenTypesOfferedElement)1 SecurityTokenReferenceElement (com.sun.identity.wsfederation.jaxb.wsse.SecurityTokenReferenceElement)1 X509DataElement (com.sun.identity.wsfederation.jaxb.xmlsig.X509DataElement)1 X509Certificate (com.sun.identity.wsfederation.jaxb.xmlsig.X509DataType.X509Certificate)1