use of ddf.security.samlp.SystemCrypto in project ddf by codice.
the class TestAttributeQueryClaimsHandler method setUp.
@Before
public void setUp() throws IOException {
signatureProperties = mock(Object.class);
encryptionProperties = mock(Object.class);
service = mock(Service.class);
dispatch = (Dispatch<StreamSource>) mock(Dispatch.class);
encryptionService = mock(EncryptionService.class);
systemCrypto = new SystemCrypto("encryption.properties", "signature.properties", encryptionService);
simpleSign = new SimpleSign(systemCrypto);
supportedClaims = new ArrayList<>();
supportedClaims.add("Role");
supportedClaims.add("NameIdentifier");
supportedClaims.add("Email");
AttributeQueryClaimsHandlerTest attributeQueryClaimsHandler = new AttributeQueryClaimsHandlerTest();
spyAttributeQueryClaimsHandler = spy(attributeQueryClaimsHandler);
spyAttributeQueryClaimsHandler.setWsdlLocation("wsdlLocation");
spyAttributeQueryClaimsHandler.setServiceName("serviceName");
spyAttributeQueryClaimsHandler.setPortName("portName");
spyAttributeQueryClaimsHandler.setSimpleSign(simpleSign);
spyAttributeQueryClaimsHandler.setSupportedClaims(supportedClaims);
spyAttributeQueryClaimsHandler.setExternalAttributeStoreUrl(EXTERNAL_ATTRIBUTE_STORE);
spyAttributeQueryClaimsHandler.setIssuer(ISSUER);
spyAttributeQueryClaimsHandler.setDestination(DESTINATION);
spyAttributeQueryClaimsHandler.setAttributeMapLocation(getClass().getClassLoader().getResource("attributeMap.properties").getPath());
spyAttributeQueryClaimsHandler.setSignatureProperties(signatureProperties);
spyAttributeQueryClaimsHandler.setEncryptionProperties(encryptionProperties);
doReturn(service).when(spyAttributeQueryClaimsHandler).createService();
doReturn(dispatch).when(spyAttributeQueryClaimsHandler).createDispatcher(service);
cannedResponse = Resources.toString(Resources.getResource(getClass(), "/SAMLResponse.xml"), Charsets.UTF_8);
}
use of ddf.security.samlp.SystemCrypto in project ddf by codice.
the class TestAttributeQueryClient method setUp.
@Before
public void setUp() throws IOException {
dispatch = mock(Dispatch.class);
encryptionService = mock(EncryptionService.class);
systemCrypto = new SystemCrypto("encryption.properties", "signature.properties", encryptionService);
SimpleSign simpleSign = new SimpleSign(systemCrypto);
spySimpleSign = spy(simpleSign);
attributeQueryClient = new AttributeQueryClient(dispatch, spySimpleSign, EXTERNAL_ATTRIBUTE_STORE, ISSUER, DESTINATION);
attributeQueryClient.setDispatch(dispatch);
attributeQueryClient.setSimpleSign(spySimpleSign);
attributeQueryClient.setExternalAttributeStoreUrl(EXTERNAL_ATTRIBUTE_STORE);
attributeQueryClient.setIssuer(ISSUER);
attributeQueryClient.setDestination(DESTINATION);
cannedResponse = Resources.toString(Resources.getResource(getClass(), "/SAMLResponse.xml"), Charsets.UTF_8);
}
use of ddf.security.samlp.SystemCrypto in project ddf by codice.
the class AssertionConsumerServiceTest method setUp.
@Before
public void setUp() throws Exception {
encryptionService = mock(EncryptionService.class);
systemCrypto = new SystemCrypto("encryption.properties", "signature.properties", encryptionService);
simpleSign = new SimpleSign(systemCrypto);
relayStates = (RelayStates<String>) mock(RelayStates.class);
when(relayStates.encode("fubar")).thenReturn(RELAY_STATE_VAL);
when(relayStates.decode(RELAY_STATE_VAL)).thenReturn(LOCATION);
loginFilter = mock(javax.servlet.Filter.class);
sessionFactory = mock(SessionFactory.class);
httpRequest = mock(HttpServletRequest.class);
when(httpRequest.getRequestURL()).thenReturn(new StringBuffer("fubar"));
when(httpRequest.isSecure()).thenReturn(true);
idpMetadata = new IdpMetadata();
assertionConsumerService = new AssertionConsumerService(simpleSign, idpMetadata, systemCrypto, relayStates);
assertionConsumerService.setRequest(httpRequest);
assertionConsumerService.setLoginFilter(loginFilter);
assertionConsumerService.setSessionFactory(sessionFactory);
cannedResponse = Resources.toString(Resources.getResource(getClass(), "/SAMLResponse.xml"), Charsets.UTF_8);
String metadata = Resources.toString(Resources.getResource(getClass(), "/IDPmetadata.xml"), Charsets.UTF_8);
deflatedSamlResponse = Resources.toString(Resources.getResource(getClass(), "/DeflatedSAMLResponse.txt"), Charsets.UTF_8);
idpMetadata.setMetadata(metadata);
}
Aggregations