FileDocCategorySizeDatePackage
DefaultSTSAttributeProvider.javaAPI DocExample3673Tue May 29 16:56:58 BST 2007com.sun.xml.ws.security.trust.impl

DefaultSTSAttributeProvider

public class DefaultSTSAttributeProvider extends Object implements com.sun.xml.ws.api.security.trust.STSAttributeProvider
author
Jiandong Guo

Fields Summary
Constructors Summary
Methods Summary
public java.util.MapgetClaimedAttributes(javax.security.auth.Subject subject, java.lang.String appliesTo, java.lang.String tokenType, com.sun.xml.ws.api.security.trust.Claims claims)

        final Set<Principal> principals = subject.getPrincipals();
        final Map<QName, List<String>> attrs = new HashMap<QName, List<String>>();
        if (principals != null){
            final Iterator iterator = principals.iterator();
            while (iterator.hasNext()){
                final String name = principals.iterator().next().getName();
                if (name != null){
                    List<String> nameIds = new ArrayList<String>();
                    nameIds.add(name);
                    attrs.put(new QName("http://sun.com", NAME_IDENTIFIER), nameIds);
                    break;
                }
            }       
        }
       
        // Set up a dumy attribute value
        final QName key = new QName("http://sun.com", "token-requestor");
        List<String> tokenRequestor = new ArrayList<String>();
        tokenRequestor.add("authenticated");
        attrs.put(key, tokenRequestor);
       
        return attrs;