Charset of attributes returned from IdP

Kirill ks.grishin at gmail.com
Tue Mar 1 01:31:10 EST 2016


Hi everybody,

I am trying to return some attributes from IdP in authentication response
which are in Japanese, but it looks like only *question marks* instead of
real characters arrive to SP.

attribute-resolver.xml extract:

<resolver:AttributeDefinition id="userName" xsi:type="ad:Scoped"
scope="%{idp.scope}" sourceAttributeID="userName">
    <resolver:Dependency ref="aaiaut" />
    <resolver:AttributeEncoder xsi:type="enc:SAML1String"
name="urn:com.example:userName" encodeType="false" />
    <resolver:AttributeEncoder xsi:type="enc:SAML2String"
name="urn:com.example:userName" friendlyName="userName" encodeType="false"
/>
</resolver:AttributeDefinition>

<resolver:DataConnector id="myDataConnector" xsi:type="dc:Script">
    <dc:Script><![CDATA[
        importPackage(Packages.net.shibboleth.idp.attribute);
        importPackage(Packages.java.util);
        importPackage(Packages.java.lang);
        importClass(Packages.com.example.contexts.UserCredentialsContext);
        ucContext =
resolutionContext.getParent().getSubcontext(UserCredentialsContext, true);
        userName = new IdPAttribute("userName");
        userNameValues = new HashSet(1);
        userNameValues.add(new
StringAttributeValue(ucContext.getuserName()));
        userName.setValues(userNameValues);
        connectorResults.add(userName);
    ]]></dc:Script>
</resolver:DataConnector>

UserCredentialsContext is populated and stored into profileRequestContext
on one of the steps of the flow. It is just a plain POJO.

attribute-filter.xml extract:

<afp:AttributeFilterPolicy id="myFilter">
    <!-- Make this rule trigget in all cases -->
    <afp:PolicyRequirementRule xsi:type="basic:ANY" />
    <!-- Release `userName` under all conditions -->
    <afp:AttributeRule attributeID="userName">
        <afp:PermitValueRule xsi:type="basic:ANY" />
    </afp:AttributeRule>
</afp:AttributeFilterPolicy>

This is what decoded response looks like on the SP side (by the way SP is
Spring Security Saml)

<?xml version="1.0" encoding="UTF-8"?>
<saml2:Assertion xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"
ID="_e695a8d590cd07ecb7ee3998c7298404"
                 IssueInstant="2016-03-01T05:33:40.640Z" Version="2.0">
    <saml2:Issuer>...</saml2:Issuer>
      ...
      <saml2:AttributeStatement>
        <saml2:Attribute FriendlyName="userName"
Name="urn:com.example:userName"

NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
            <saml2:AttributeValue>???????</saml2:AttributeValue>
        </saml2:Attribute>
    </saml2:AttributeStatement>
</saml2:Assertion>

Any ideas how to get it returned in the correct encoding?

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20160301/ba17bdfa/attachment.html>


More information about the users mailing list