use of org.forgerock.openam.sts.user.invocation.X509TokenState in project OpenAM by OpenRock.
the class TokenRequestMarshallerImplTest method testX509CertificateTokenMarshalling.
@Test
public void testX509CertificateTokenMarshalling() throws Exception {
X509Certificate certificate = getCertificate();
ClientContext clientInfoContext = ClientContext.buildExternalClientContext(null).certificates(certificate).build();
@SuppressWarnings("unchecked") RestTokenTransformValidatorParameters<X509Certificate[]> params = (RestTokenTransformValidatorParameters<X509Certificate[]>) tokenMarshaller.buildTokenTransformValidatorParameters(new X509TokenState().toJson(), clientInfoContext);
assertEquals(certificate.getEncoded(), (params.getInputToken()[0].getEncoded()));
}
use of org.forgerock.openam.sts.user.invocation.X509TokenState in project OpenAM by OpenRock.
the class TokenRequestMarshallerImplTest method testMissingX509CertificateTokenMarshalling.
@Test(expectedExceptions = TokenMarshalException.class)
public void testMissingX509CertificateTokenMarshalling() throws Exception {
ClientContext clientInfoContext = ClientContext.buildExternalClientContext(null).build();
//no certificate present in the ClientContext, and the offload header set to "" by the module above, so
//exception should be thrown
tokenMarshaller.buildTokenTransformValidatorParameters(new X509TokenState().toJson(), clientInfoContext);
}
Aggregations