コード例 #1
0
ファイル: PlatformSPFilter.java プロジェクト: ossbase/p1
  protected void initKeyProvider() {
    if (!doSupportSignature()) {
      return;
    }

    SPType configuration = getConfiguration();
    KeyProviderType keyProvider = configuration.getKeyProvider();

    if (keyProvider == null && doSupportSignature()) {
      throw new RuntimeException(
          ErrorCodes.NULL_VALUE + "KeyProvider is null for context=" + getContextPath());
    }

    try {
      String keyManagerClassName = keyProvider.getClassName();
      if (keyManagerClassName == null) {
        throw new RuntimeException(ErrorCodes.NULL_VALUE + "KeyManager class name");
      }

      Class<?> clazz = SecurityActions.loadClass(getClass(), keyManagerClassName);

      if (clazz == null) {
        throw new ClassNotFoundException(ErrorCodes.CLASS_NOT_LOADED + keyManagerClassName);
      }

      TrustKeyManager keyManager = (TrustKeyManager) clazz.newInstance();

      List<AuthPropertyType> authProperties = CoreConfigUtil.getKeyProviderProperties(keyProvider);

      keyManager.setAuthProperties(authProperties);
      keyManager.setValidatingAlias(keyProvider.getValidatingAlias());

      String identityURL = configuration.getIdentityURL();

      // Special case when you need X509Data in SignedInfo
      if (authProperties != null) {
        for (AuthPropertyType authPropertyType : authProperties) {
          String key = authPropertyType.getKey();
          if (GeneralConstants.X509CERTIFICATE.equals(key)) {
            // we need X509Certificate in SignedInfo. The value is the alias name
            keyManager.addAdditionalOption(
                GeneralConstants.X509CERTIFICATE, authPropertyType.getValue());
            break;
          }
        }
      }
      keyManager.addAdditionalOption(
          ServiceProviderBaseProcessor.IDP_KEY, new URL(identityURL).getHost());
      this.keyManager = keyManager;
    } catch (Exception e) {
      logger.trustKeyManagerCreationError(e);
      throw new RuntimeException(e.getLocalizedMessage());
    }

    logger.trace("Key Provider=" + keyProvider.getClassName());
  }
コード例 #2
0
ファイル: PlatformSPFilter.java プロジェクト: ossbase/p1
  protected IDPSSODescriptorType getIDPSSODescriptor(EntitiesDescriptorType entities) {
    List<Object> entityDescs = entities.getEntityDescriptor();
    for (Object entityDescriptor : entityDescs) {

      if (entityDescriptor instanceof EntitiesDescriptorType) {
        return getIDPSSODescriptor((EntitiesDescriptorType) entityDescriptor);
      }
      return CoreConfigUtil.getIDPDescriptor((EntityDescriptorType) entityDescriptor);
    }
    return null;
  }
コード例 #3
0
ファイル: PlatformSPFilter.java プロジェクト: ossbase/p1
  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;
  }
コード例 #4
0
  /** @see SAMLConfigurationProvider#getSPConfiguration() */
  public SPType getSPConfiguration() throws ProcessingException {
    SPType spType = null;
    if (fileAvailable()) {
      try {
        EntitiesDescriptorType entities = parseMDFile();
        spType = CoreConfigUtil.getSPConfiguration(entities, bindingURI);
      } catch (ParsingException e) {
        throw logger.processingError(e);
      }
    } else {
      throw logger.nullValueError(SP_MD_FILE);
    }

    if (configParsedSPType != null) {
      spType.importFrom(configParsedSPType);
    }
    return spType;
  }
コード例 #5
0
ファイル: PlatformSPFilter.java プロジェクト: ossbase/p1
 protected IDPSSODescriptorType handleMetadata(EntityDescriptorType entityDescriptor) {
   return CoreConfigUtil.getIDPDescriptor(entityDescriptor);
 }