org.opensaml.security.credential.BasicCredential Java Examples

The following examples show how to use org.opensaml.security.credential.BasicCredential. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AuthnRequestFactoryTest.java    From verify-service-provider with MIT License 6 votes vote down vote up
@Before
public void setUp() throws KeyException {
    IdaSamlBootstrap.bootstrap();
    reset(manifestReader);

    final BasicCredential basicCredential = createBasicCredential();
    encrypter = new uk.gov.ida.saml.security.EncrypterFactory().createEncrypter(basicCredential);
    decrypter = new DecrypterFactory().createDecrypter(ImmutableList.of(basicCredential));
    when(encrypterFactory.createEncrypter()).thenReturn(encrypter);
    PrivateKeyStore privateKeyStore = new PrivateKeyStoreFactory().create(TestEntityIds.TEST_RP);
    KeyPair keyPair = new KeyPair(KeySupport.derivePublicKey(privateKeyStore.getSigningPrivateKey()), privateKeyStore.getSigningPrivateKey());
    factory = new AuthnRequestFactory(
        DESTINATION,
        keyPair,
        manifestReader,
        encrypterFactory
    );
}
 
Example #2
Source File: MatchingAssertionTranslatorTest.java    From verify-service-provider with MIT License 4 votes vote down vote up
private Credential createMSSigningCredential() {
    Credential signingCredential = new TestCredentialFactory(TEST_RP_MS_PUBLIC_SIGNING_CERT, TEST_RP_MS_PRIVATE_SIGNING_KEY).getSigningCredential();
    ((BasicCredential) signingCredential).setEntityId(TestEntityIds.TEST_RP_MS);
    return signingCredential;
}
 
Example #3
Source File: AuthnRequestFactoryTest.java    From verify-service-provider with MIT License 4 votes vote down vote up
private BasicCredential createBasicCredential() {
    final PublicKey publicKey = new PublicKeyFactory(new X509CertificateFactory()).createPublicKey(HUB_TEST_PUBLIC_ENCRYPTION_CERT);
    PrivateKey privateKey = new PrivateKeyFactory().createPrivateKey(Base64.decodeBase64(HUB_TEST_PRIVATE_ENCRYPTION_KEY));
    return new BasicCredential(publicKey, privateKey);
}