/** * Given a metadata {@link EntityDescriptorType}, construct the Service provider configuration * * @param entityDescriptor * @param bindingURI * * @return */ public static ProviderType getSPConfiguration(EntityDescriptorType entityDescriptor, String bindingURI) { SPType spType = new SPType(); String identityURL = null; String serviceURL = null; if (identityURL == null) { IDPSSODescriptorType idpSSO = getIDPDescriptor(entityDescriptor); if (idpSSO != null) { identityURL = getIdentityURL(idpSSO, bindingURI); } spType.setIdentityURL(identityURL); } if (serviceURL == null) { SPSSODescriptorType spSSO = getSPDescriptor(entityDescriptor); if (spSSO != null) { serviceURL = getServiceURL(spSSO, bindingURI); } spType.setServiceURL(serviceURL); } return spType; }
/** * Get the validating key * @param idpSpConfiguration * @param domain * @return * @throws ConfigurationException * @throws ProcessingException */ public static PublicKey getValidatingKey(ProviderType idpSpConfiguration, String domain) throws ConfigurationException, ProcessingException { TrustKeyManager trustKeyManager = getTrustKeyManager(idpSpConfiguration); return getValidatingKey(trustKeyManager, domain); }
private IDPSSODescriptorType getIdpMetadataFromProvider(SPType spConfiguration) { List<EntityDescriptorType> entityDescriptors = CoreConfigUtil.getMetadataConfiguration(spConfiguration, this.servletContext); if (entityDescriptors != null) { for (EntityDescriptorType entityDescriptorType : entityDescriptors) { IDPSSODescriptorType idpssoDescriptorType = handleMetadata(entityDescriptorType); if (idpssoDescriptorType != null) { return idpssoDescriptorType; } } } return null; }
/** * Given a {@code TokenProviderType}, return the list of properties that have been decrypted for any masked property value * * @param tokenProviderType * @return * @throws GeneralSecurityException */ @SuppressWarnings("unchecked") public static List<KeyValueType> getProperties(TokenProviderType tokenProviderType) throws GeneralSecurityException { List<KeyValueType> keyValueTypeList = tokenProviderType.getProperty(); if (decryptionNeeded(keyValueTypeList)) keyValueTypeList = decryptPasswords(keyValueTypeList); return keyValueTypeList; }
/** * Given a metadata {@link EntityDescriptorType}, construct the Service provider configuration * * @param entityDescriptor * @param bindingURI * @return */ public static ProviderType getSPConfiguration(EntityDescriptorType entityDescriptor, String bindingURI) { SPType spType = new SPType(); String identityURL = null; String serviceURL = null; if (identityURL == null) { IDPSSODescriptorType idpSSO = getIDPDescriptor(entityDescriptor); if (idpSSO != null) { identityURL = getIdentityURL(idpSSO, bindingURI); spType.setIdentityURL(identityURL); spType.setLogoutUrl(getLogoutURL(idpSSO, bindingURI)); spType.setLogoutResponseLocation(getLogoutResponseLocation(idpSSO, bindingURI)); } } if (serviceURL == null) { SPSSODescriptorType spSSO = getSPDescriptor(entityDescriptor); if (spSSO != null) { serviceURL = getServiceURL(spSSO, bindingURI); } spType.setServiceURL(serviceURL); } return spType; }
protected void initKeyManager() { if (this.idpConfiguration.isSupportsSignature() || this.idpConfiguration.isEncrypt()) { KeyProviderType keyProvider = this.idpConfiguration.getKeyProvider(); if (keyProvider == null) throw new RuntimeException( logger.nullValueError("Key Provider is null for context=" + servletContext.getContextPath())); //$NON-NLS-1$ try { this.keyManager = CoreConfigUtil.getTrustKeyManager(keyProvider); List<AuthPropertyType> authProperties = CoreConfigUtil.getKeyProviderProperties(keyProvider); keyManager.setAuthProperties(authProperties); keyManager.setValidatingAlias(keyProvider.getValidatingAlias()); } catch (Exception e) { logger.trustKeyManagerCreationError(e); throw new RuntimeException(e.getLocalizedMessage()); } logger.samlIDPSettingCanonicalizationMethod(idpConfiguration.getCanonicalizationMethod()); XMLSignatureUtil.setCanonicalizationMethodType(idpConfiguration.getCanonicalizationMethod()); logger.trace("Key Provider=" + keyProvider.getClassName()); //$NON-NLS-1$ } }
protected IDPSSODescriptorType handleMetadata(EntityDescriptorType entityDescriptor) { return CoreConfigUtil.getIDPDescriptor(entityDescriptor); }
List<EntityDescriptorType> entityDescriptors = CoreConfigUtil.getMetadataConfiguration(idpConfiguration, servletContext); if (entityDescriptors != null) { for (EntityDescriptorType entityDescriptorType : entityDescriptors) { SPSSODescriptorType spSSODescriptor = CoreConfigUtil.getSPDescriptor(entityDescriptorType); if (spSSODescriptor != null) { spSSOMetadataMap.put(entityDescriptorType.getEntityID(), spSSODescriptor);
this.keyManager = (TrustKeyManager) clazz.newInstance(); List<AuthPropertyType> authProperties = CoreConfigUtil.getKeyProviderProperties(keyProvider);
/** * @see SAMLConfigurationProvider#getIDPConfiguration() */ public IDPType getIDPConfiguration() throws ProcessingException { IDPType idpType = null; if (fileAvailable()) { try { EntitiesDescriptorType entities = parseMDFile(); IDPSSODescriptorType idpSSO = CoreConfigUtil.getIDPDescriptor(entities); if (idpSSO != null) { idpType = CoreConfigUtil.getIDPType(idpSSO); } } catch (ParsingException e) { throw new ProcessingException(e); } } if (configParsedIDPType != null) { idpType.importFrom(configParsedIDPType); } return idpType; }
issuerPublicKey = CoreConfigUtil.getValidatingKey(keyManager, issuerHost); } catch (IllegalStateException ise) { logger.trace("Token issuer is not found for: " + issuer, ise); //$NON-NLS-1$ issuerPublicKey = CoreConfigUtil.getValidatingKey(keyManager, issuerHost);
/** * Given either the IDP Configuration or the SP Configuration, derive * the TrustKeyManager * @param idpOrSPConfiguration * @return */ public static TrustKeyManager getTrustKeyManager(ProviderType idpOrSPConfiguration) { KeyProviderType keyProvider = idpOrSPConfiguration.getKeyProvider(); return getTrustKeyManager(keyProvider); }
if (metadata instanceof EntitiesDescriptorType) { EntitiesDescriptorType entities = (EntitiesDescriptorType) metadata; spType = CoreConfigUtil.getSPConfiguration(entities, bindingURI); } else if (metadata instanceof EntityDescriptorType) { EntityDescriptorType entity = (EntityDescriptorType) metadata; spType = (SPType) CoreConfigUtil.getSPConfiguration(entity, bindingURI); } else { throw logger.wrongMetadataRootElement();
/** * <p>Configures the IDP trusted domains by looking at {@link SPSSODescriptorType} definitions along the * metadata.</p> * * @param idpType * @param entities */ private void configureTrustedDomainsFromMetadata(IDPType idpType, EntitiesDescriptorType entities) { if (idpType.getTrust() == null) { idpType.setTrust(new TrustType()); } for (Object entityDescriptorObj : entities.getEntityDescriptor()) { EntityDescriptorType entityDescriptorType = (EntityDescriptorType) entityDescriptorObj; SPSSODescriptorType spDescriptor = CoreConfigUtil.getSPDescriptor(entityDescriptorType); if (spDescriptor != null) { for (IndexedEndpointType assertionConsumerService : spDescriptor.getAssertionConsumerService()) { URI location = assertionConsumerService.getLocation(); idpType.getTrust().addDomain(location.getHost()); } } } }
for (Object theObject : list) { if (theObject instanceof EntitiesDescriptorType) { spType = getSPConfiguration((EntitiesDescriptorType) theObject, bindingURI); } else if (theObject instanceof EntityDescriptorType) { if (idpSSO == null) { idpSSO = getIDPDescriptor((EntityDescriptorType) theObject); spSSO = getSPDescriptor((EntityDescriptorType) theObject); String identityURL = getIdentityURL(idpSSO, bindingURI); spType.setLogoutUrl(getLogoutURL(idpSSO, bindingURI)); spType.setLogoutResponseLocation(getLogoutResponseLocation(idpSSO, bindingURI)); String serviceURL = getServiceURL(spSSO, bindingURI);
keyManager = CoreConfigUtil.getTrustKeyManager(keyProvider); List<AuthPropertyType> authProperties = CoreConfigUtil.getKeyProviderProperties(keyProvider); keyManager.setAuthProperties(authProperties); keyManager.setValidatingAlias(keyProvider.getValidatingAlias());
protected IDPSSODescriptorType handleMetadata(EntityDescriptorType entityDescriptor) { return CoreConfigUtil.getIDPDescriptor(entityDescriptor); }
List<EntityDescriptorType> entityDescriptors = CoreConfigUtil.getMetadataConfiguration(idpConfiguration, servletContext); if (entityDescriptors != null) { for (EntityDescriptorType entityDescriptorType : entityDescriptors) { SPSSODescriptorType spSSODescriptor = CoreConfigUtil.getSPDescriptor(entityDescriptorType); if (spSSODescriptor != null) { spSSOMetadataMap.put(entityDescriptorType.getEntityID(), spSSODescriptor);
this.keyManager = (TrustKeyManager) clazz.newInstance(); List<AuthPropertyType> authProperties = CoreConfigUtil.getKeyProviderProperties(keyProvider);
/** * @see SAMLConfigurationProvider#getIDPConfiguration() */ public IDPType getIDPConfiguration() throws ProcessingException { IDPType idpType = null; if (fileAvailable()) { try { EntitiesDescriptorType entities = parseMDFile(); IDPSSODescriptorType idpSSO = CoreConfigUtil.getIDPDescriptor(entities); if (idpSSO != null) { idpType = CoreConfigUtil.getIDPType(idpSSO); } } catch (ParsingException e) { throw new ProcessingException(e); } } if (configParsedIDPType != null) { idpType.importFrom(configParsedIDPType); } return idpType; }