List<String> roles = CastUtils.cast((List<?>)m.getContextualProperty("saml.roles"));
if (roles == null) {
roles = Collections.singletonList("user");
}
List<AttributeBean> claims = new ArrayList<AttributeBean>();
AttributeBean roleClaim = new AttributeBean();
roleClaim.setSimpleName("subject-role");
roleClaim.setQualifiedName(Claim.DEFAULT_ROLE_NAME);
roleClaim.setNameFormat(Claim.DEFAULT_NAME_FORMAT);
roleClaim.setAttributeValues(roles);
claims.add(roleClaim);
List<String> authMethods = CastUtils.cast((List<?>)m.getContextualProperty("saml.auth"));
if (authMethods == null) {
authMethods = Collections.singletonList("password");
}
AttributeBean authClaim = new AttributeBean();
authClaim.setQualifiedName("http://claims/authentication");
authClaim.setNameFormat("http://claims/authentication-format");
authClaim.setAttributeValues(authMethods);
claims.add(authClaim);
attrBean.setSamlAttributes(claims);
callback.setAttributeStatementData(Collections.singletonList(attrBean));
}