use of org.apache.cxf.sts.token.provider.DefaultSubjectProvider in project cas by apereo.
the class CoreWsSecuritySecurityTokenServiceConfiguration method transportSamlTokenProvider.
@RefreshScope
@Bean
public SAMLTokenProvider transportSamlTokenProvider() {
final WsFederationProperties.SecurityTokenService wsfed = casProperties.getAuthn().getWsfedIdP().getSts();
final DefaultSubjectProvider s = new DefaultSubjectProvider();
switch(wsfed.getSubjectNameIdFormat().trim().toLowerCase()) {
case "email":
s.setSubjectNameIDFormat(NameID.EMAIL);
break;
case "entity":
s.setSubjectNameIDFormat(NameID.ENTITY);
break;
case "transient":
s.setSubjectNameIDFormat(NameID.TRANSIENT);
break;
case "unspecified":
default:
s.setSubjectNameIDFormat(NameID.UNSPECIFIED);
break;
}
final DefaultConditionsProvider c = new DefaultConditionsProvider();
c.setAcceptClientLifetime(true);
final SAMLTokenProvider provider = new SAMLTokenProvider();
provider.setAttributeStatementProviders(Arrays.asList(new ClaimsAttributeStatementProvider()));
provider.setRealmMap(realms());
provider.setConditionsProvider(c);
provider.setSubjectProvider(s);
return provider;
}
Aggregations