use of com.sun.identity.saml2.assertion.SubjectConfirmationData in project OpenAM by OpenRock.
the class DefaultSubjectProviderTest method testHoKSubjectConfirmation.
@Test
public void testHoKSubjectConfirmation() throws Exception {
SubjectProvider subjectProvider = new DefaultSubjectProvider(Guice.createInjector(new MyModule()).getInstance(KeyInfoFactory.class));
Date issueInstant = new Date();
Subject subject = subjectProvider.get(SUBJECT_ID, AUDIENCE_ID, createSAML2Config(), SAML2SubjectConfirmation.HOLDER_OF_KEY, issueInstant, getProofState());
assertEquals(SUBJECT_ID, subject.getNameID().getValue());
assertEquals(NAME_ID_FORMAT, subject.getNameID().getFormat());
SubjectConfirmation subjectConfirmation = (SubjectConfirmation) subject.getSubjectConfirmation().get(0);
assertEquals(SAML2Constants.SUBJECT_CONFIRMATION_METHOD_HOLDER_OF_KEY, subjectConfirmation.getMethod());
SubjectConfirmationData subjectConfirmationData = subjectConfirmation.getSubjectConfirmationData();
assertTrue(subjectConfirmationData != null);
assertEquals(subjectConfirmationData.getContentType(), KEY_INFO_CONFIRMATION_DATA_TYPE);
//see if we can go from xml back to class instance.
AssertionFactory.getInstance().createSubjectConfirmationData(subjectConfirmationData.toXMLString(true, true));
}
Aggregations