private void initSAML2() throws ConfigurationException, ConfigXMLParsingException, MetadataProviderException { if (logger.isDebugEnabled()) { logger.debug("initSAML2() - start"); // $NON-NLS-1$ } // // One-time init code here // DefaultBootstrap.bootstrap(); StorageService<String, ReplayCacheEntry> storageEngine = new MapBasedStorageService<String, ReplayCacheEntry>(); ReplayCache replayCache = new ReplayCache(storageEngine, 60 * 1000 * replayMinutes); replayRule = new MessageReplayRule(replayCache); // Get the private key that corresponds to a public key that may // have been used by other parties for encryption Credential decryptionCredential = getDecryptionCredential(decryptionKey.getKeystore(), localEntityId); List<Credential> localCredentials = new ArrayList<Credential>(); localCredentials.add(decryptionCredential); CollectionCredentialResolver localCredResolver = new CollectionCredentialResolver(localCredentials); // Support EncryptedKey/KeyInfo containing decryption key hints via // KeyValue/RSAKeyValue and X509Data/X509Certificate List<KeyInfoProvider> kiProviders = new ArrayList<KeyInfoProvider>(); kiProviders.add(new RSAKeyValueProvider()); kiProviders.add(new InlineX509DataProvider()); // Resolves local credentials by using information in the EncryptedKey/KeyInfo to query the // supplied // local credential resolver. kekResolver = new LocalKeyInfoCredentialResolver(kiProviders, localCredResolver); // Supports resolution of EncryptedKeys by 3 common placement mechanisms encryptedKeyResolver = new ChainingEncryptedKeyResolver(); encryptedKeyResolver.getResolverChain().add(new InlineEncryptedKeyResolver()); encryptedKeyResolver.getResolverChain().add(new EncryptedElementTypeEncryptedKeyResolver()); encryptedKeyResolver.getResolverChain().add(new SimpleRetrievalMethodEncryptedKeyResolver()); // siginingCredential = // getVerificationCredential(signingKey.getKeystore(),signingKey.getEntityId()); MetadataProvider mdProvider = getMetadataProvider(); MetadataCredentialResolver mdCredResolver = new MetadataCredentialResolver(mdProvider); KeyInfoCredentialResolver keyInfoCredResolver = Configuration.getGlobalSecurityConfiguration().getDefaultKeyInfoCredentialResolver(); trustEngine = new CustomKeySignatureTrustEngine(mdCredResolver, keyInfoCredResolver); if (logger.isDebugEnabled()) { logger.debug("initSAML2() - end"); // $NON-NLS-1$ } }
static { encryptedKeyResolver.getResolverChain().add(new InlineEncryptedKeyResolver()); encryptedKeyResolver.getResolverChain().add(new EncryptedElementTypeEncryptedKeyResolver()); encryptedKeyResolver.getResolverChain().add(new SimpleRetrievalMethodEncryptedKeyResolver()); }