Search in sources :

Example 1 with ClaimType

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

the class CreateWSFedMetaDataTemplate method addWSFedIdentityProviderTemplate.

private static void addWSFedIdentityProviderTemplate(String entityId, com.sun.identity.wsfederation.jaxb.wsfederation.ObjectFactory objFactory, FederationElement fed, Map mapParams, String url) throws JAXBException, CertificateEncodingException {
    if (url == null) {
        url = getHostURL();
    }
    String idpAlias = (String) mapParams.get(MetaTemplateParameters.P_IDP);
    String idpSCertAlias = (String) mapParams.get(MetaTemplateParameters.P_IDP_S_CERT);
    String maStr = buildMetaAliasInURI(idpAlias);
    if ((idpSCertAlias != null) && idpSCertAlias.length() > 0) {
        com.sun.identity.wsfederation.jaxb.wsse.ObjectFactory secextObjFactory = new com.sun.identity.wsfederation.jaxb.wsse.ObjectFactory();
        com.sun.identity.wsfederation.jaxb.xmlsig.ObjectFactory dsObjectFactory = new com.sun.identity.wsfederation.jaxb.xmlsig.ObjectFactory();
        TokenSigningKeyInfoElement tski = objFactory.createTokenSigningKeyInfoElement();
        SecurityTokenReferenceElement str = secextObjFactory.createSecurityTokenReferenceElement();
        X509DataElement x509Data = dsObjectFactory.createX509DataElement();
        X509Certificate x509Cert = dsObjectFactory.createX509DataTypeX509Certificate();
        x509Cert.setValue(KeyUtil.getKeyProviderInstance().getX509Certificate(idpSCertAlias).getEncoded());
        x509Data.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(x509Cert);
        str.getAny().add(x509Data);
        tski.setSecurityTokenReference(str);
        fed.getAny().add(tski);
    }
    TokenIssuerNameElement tin = objFactory.createTokenIssuerNameElement();
    tin.setValue(entityId);
    fed.getAny().add(tin);
    TokenIssuerEndpointElement tie = objFactory.createTokenIssuerEndpointElement();
    com.sun.identity.wsfederation.jaxb.wsaddr.ObjectFactory addrObjFactory = new com.sun.identity.wsfederation.jaxb.wsaddr.ObjectFactory();
    AttributedURIType auri = addrObjFactory.createAttributedURIType();
    auri.setValue(url + "/WSFederationServlet" + maStr);
    tie.setAddress(auri);
    fed.getAny().add(tie);
    TokenTypesOfferedElement tto = objFactory.createTokenTypesOfferedElement();
    TokenType tt = objFactory.createTokenType();
    tt.setUri(WSFederationConstants.URN_OASIS_NAMES_TC_SAML_11);
    tto.getTokenType().add(tt);
    fed.getAny().add(tto);
    UriNamedClaimTypesOfferedElement uncto = objFactory.createUriNamedClaimTypesOfferedElement();
    ClaimType ct = objFactory.createClaimType();
    ct.setUri(WSFederationConstants.NAMED_CLAIM_TYPES[WSFederationConstants.NAMED_CLAIM_UPN]);
    DisplayNameType dnt = objFactory.createDisplayNameType();
    dnt.setValue(WSFederationConstants.NAMED_CLAIM_DISPLAY_NAMES[WSFederationConstants.NAMED_CLAIM_UPN]);
    ct.setDisplayName(dnt);
    uncto.getClaimType().add(ct);
    fed.getAny().add(uncto);
}
Also used : TokenTypesOfferedElement(com.sun.identity.wsfederation.jaxb.wsfederation.TokenTypesOfferedElement) AttributedURIType(com.sun.identity.wsfederation.jaxb.wsaddr.AttributedURIType) TokenIssuerEndpointElement(com.sun.identity.wsfederation.jaxb.wsfederation.TokenIssuerEndpointElement) ClaimType(com.sun.identity.wsfederation.jaxb.wsfederation.ClaimType) TokenType(com.sun.identity.wsfederation.jaxb.wsfederation.TokenType) X509DataElement(com.sun.identity.wsfederation.jaxb.xmlsig.X509DataElement) TokenIssuerNameElement(com.sun.identity.wsfederation.jaxb.wsfederation.TokenIssuerNameElement) UriNamedClaimTypesOfferedElement(com.sun.identity.wsfederation.jaxb.wsfederation.UriNamedClaimTypesOfferedElement) SecurityTokenReferenceElement(com.sun.identity.wsfederation.jaxb.wsse.SecurityTokenReferenceElement) DisplayNameType(com.sun.identity.wsfederation.jaxb.wsfederation.DisplayNameType) X509Certificate(com.sun.identity.wsfederation.jaxb.xmlsig.X509DataType.X509Certificate) TokenSigningKeyInfoElement(com.sun.identity.wsfederation.jaxb.wsfederation.TokenSigningKeyInfoElement)

Example 2 with ClaimType

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

the class WSFedPropertiesModelImpl method setIDPSTDAttributeValues.

/**
     * Saves the standard attribute values for the IDP.
     *
     * @param entityName is entityid.
     * @param idpStdValues contain standard attribute values of idp.
     * @param realm to which the entity belongs.
     * @param idpExtValues contain extended attribute values.
     * @param location the information whether remote or hosted.
     * @throws AMConsoleException if saving of attribute value fails.
     */
public void setIDPSTDAttributeValues(String entityName, Map idpStdValues, String realm, Map idpExtValues, String location) throws AMConsoleException {
    FederationElement fedElem = getEntityDesc(realm, entityName);
    List claimList = null;
    ClaimType claimType = null;
    DisplayNameType displayName = null;
    String value = null;
    UriNamedClaimTypesOfferedElement UriNamedclaimTypes = null;
    try {
        UriNamedclaimTypes = getWSFederationMetaManager().getUriNamedClaimTypesOffered(fedElem);
    } catch (WSFederationMetaException we) {
        UriNamedclaimTypes = null;
    }
    if (UriNamedclaimTypes != null) {
        int iClaim = 0;
        claimList = UriNamedclaimTypes.getClaimType();
        for (iClaim = 0; iClaim < claimList.size(); iClaim += 1) {
            claimType = (ClaimType) claimList.get(iClaim);
            displayName = claimType.getDisplayName();
        }
    }
    HashSet set = (HashSet) idpStdValues.get(WSFedPropertiesModel.TFCLAIM_TYPES);
    Iterator i = set.iterator();
    while ((i != null) && (i.hasNext())) {
        value = (String) i.next();
    }
    if ((value.toString()).equals(WSFederationConstants.NAMED_CLAIM_DISPLAY_NAMES[WSFederationConstants.NAMED_CLAIM_COMMONNAME])) {
        displayName.setValue(WSFederationConstants.NAMED_CLAIM_DISPLAY_NAMES[WSFederationConstants.NAMED_CLAIM_COMMONNAME]);
        claimType.setUri(WSFederationConstants.NAMED_CLAIM_TYPES[WSFederationConstants.NAMED_CLAIM_COMMONNAME]);
    } else if (value.toString().equals(WSFederationConstants.NAMED_CLAIM_DISPLAY_NAMES[WSFederationConstants.NAMED_CLAIM_EMAILADDRESS])) {
        displayName.setValue(WSFederationConstants.NAMED_CLAIM_DISPLAY_NAMES[WSFederationConstants.NAMED_CLAIM_EMAILADDRESS]);
        claimType.setUri(WSFederationConstants.NAMED_CLAIM_TYPES[WSFederationConstants.NAMED_CLAIM_EMAILADDRESS]);
    } else if (value.toString().equals(WSFederationConstants.NAMED_CLAIM_DISPLAY_NAMES[WSFederationConstants.NAMED_CLAIM_UPN])) {
        displayName.setValue(WSFederationConstants.NAMED_CLAIM_DISPLAY_NAMES[WSFederationConstants.NAMED_CLAIM_UPN]);
        claimType.setUri(WSFederationConstants.NAMED_CLAIM_TYPES[WSFederationConstants.NAMED_CLAIM_UPN]);
    }
    try {
        if (location.equals("hosted")) {
            String idp_certalias = getResult(idpExtValues, TFSIGNCERT_ALIAS);
            WSFederationMetaSecurityUtils.updateProviderKeyInfo(realm, entityName, idp_certalias, true);
        }
        getWSFederationMetaManager().setFederation(realm, fedElem);
    } catch (WSFederationMetaException e) {
        debug.warning("WSFedPropertiesModelImpl.setIDPSTDAttributeValues", e);
        throw new AMConsoleException(e.getMessage());
    }
}
Also used : UriNamedClaimTypesOfferedElement(com.sun.identity.wsfederation.jaxb.wsfederation.UriNamedClaimTypesOfferedElement) Iterator(java.util.Iterator) List(java.util.List) WSFederationMetaException(com.sun.identity.wsfederation.meta.WSFederationMetaException) DisplayNameType(com.sun.identity.wsfederation.jaxb.wsfederation.DisplayNameType) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) FederationElement(com.sun.identity.wsfederation.jaxb.wsfederation.FederationElement) ClaimType(com.sun.identity.wsfederation.jaxb.wsfederation.ClaimType) HashSet(java.util.HashSet)

Example 3 with ClaimType

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

the class WSFedPropertiesModelImpl method getClaimType.

/**
     * Returns display name of claim type.
     *
     * @param fedElem is the FederationElement Object.
     * @return display name of claim type.
     */
public String getClaimType(FederationElement fedElem) {
    List claimList = null;
    String displayName = null;
    UriNamedClaimTypesOfferedElement UriNamedclaimTypes = null;
    try {
        UriNamedclaimTypes = getWSFederationMetaManager().getUriNamedClaimTypesOffered(fedElem);
    } catch (WSFederationMetaException we) {
        UriNamedclaimTypes = null;
    }
    //assuming there is only 1 claim type object now
    if (UriNamedclaimTypes != null) {
        int iClaim = 0;
        int arr = 0;
        claimList = UriNamedclaimTypes.getClaimType();
        for (iClaim = 0; iClaim < claimList.size(); iClaim += 1) {
            ClaimType claimType = (ClaimType) claimList.get(iClaim);
            displayName = claimType.getDisplayName().getValue();
        }
    }
    return displayName;
}
Also used : UriNamedClaimTypesOfferedElement(com.sun.identity.wsfederation.jaxb.wsfederation.UriNamedClaimTypesOfferedElement) List(java.util.List) WSFederationMetaException(com.sun.identity.wsfederation.meta.WSFederationMetaException) ClaimType(com.sun.identity.wsfederation.jaxb.wsfederation.ClaimType)

Aggregations

ClaimType (com.sun.identity.wsfederation.jaxb.wsfederation.ClaimType)3 UriNamedClaimTypesOfferedElement (com.sun.identity.wsfederation.jaxb.wsfederation.UriNamedClaimTypesOfferedElement)3 DisplayNameType (com.sun.identity.wsfederation.jaxb.wsfederation.DisplayNameType)2 WSFederationMetaException (com.sun.identity.wsfederation.meta.WSFederationMetaException)2 List (java.util.List)2 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)1 AttributedURIType (com.sun.identity.wsfederation.jaxb.wsaddr.AttributedURIType)1 FederationElement (com.sun.identity.wsfederation.jaxb.wsfederation.FederationElement)1 TokenIssuerEndpointElement (com.sun.identity.wsfederation.jaxb.wsfederation.TokenIssuerEndpointElement)1 TokenIssuerNameElement (com.sun.identity.wsfederation.jaxb.wsfederation.TokenIssuerNameElement)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 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1