Skip to content

Instantly share code, notes, and snippets.

@harrdou
Created October 30, 2019 19:22
Show Gist options
  • Save harrdou/1d366a23a50c33f5b401def8eef223b8 to your computer and use it in GitHub Desktop.
Save harrdou/1d366a23a50c33f5b401def8eef223b8 to your computer and use it in GitHub Desktop.
CATSv2IDPAttributeMapper from the CATS IDP Simulator
package ca.gc.ssc.cats;
import com.sun.identity.saml2.plugins.DefaultIDPAttributeMapper;
import com.sun.identity.saml2.common.SAML2Exception;
import java.util.List;
/**
* This class <code>CATSv2IDPAttributeMapper</code> implements the
* <code>IDPAttributeMapper</code> to return the only SAML Attribute
* mandated by CATS v2 for insertion in the SAML Assertion.
*/
public class CATSv2IDPAttributeMapper extends DefaultIDPAttributeMapper
{
/**
* Constructor
*/
public CATSv2IDPAttributeMapper() {
super();
}
public List getAttributes(Object session, String hostEntityID,
String remoteEntityID, String realm) throws SAML2Exception
{
List attributes = new java.util.ArrayList();
String[] values = {"2.0"}; // CATS Version
attributes.add(getSAMLAttribute("ca:gc:cyber-authentication:basic:specVer",
"urn:oasis:names:tc:SAML:2.0:attrname-format:uri",
values, hostEntityID, remoteEntityID, realm) );
return attributes;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment