@Override protected Builder<T> readFrom(T configuration) { for (Class<? extends CredentialHandler> credentialHandler : configuration.getCredentialHandlers()) { addCredentialHandler(credentialHandler); } for (String credentialProperty : configuration.getCredentialHandlerProperties().keySet()) { Object value = configuration.getCredentialHandlerProperties().get(credentialProperty); setCredentialHandlerProperty(credentialProperty, value); } for (Class<? extends AttributedType> supportedType : configuration.getSupportedTypes().keySet()) { supportType(supportedType); if (Relationship.class.isAssignableFrom(supportedType)) { supportGlobalRelationship((Class<? extends Relationship>) supportedType); } } for (Class<? extends AttributedType> unsupportedType : configuration.getUnsupportedTypes().keySet()) { unsupportType(unsupportedType); } for (ContextInitializer contextInitializer : configuration.getContextInitializers()) { addContextInitializer(contextInitializer); } supportAttributes(configuration.supportsAttribute()); supportCredentials(configuration.supportsCredential()); supportPermissions(configuration.supportsPermissions()); return this; }
@Override protected Builder<T> readFrom(T configuration) { for (Class<? extends CredentialHandler> credentialHandler : configuration.getCredentialHandlers()) { addCredentialHandler(credentialHandler); } for (String credentialProperty : configuration.getCredentialHandlerProperties().keySet()) { Object value = configuration.getCredentialHandlerProperties().get(credentialProperty); setCredentialHandlerProperty(credentialProperty, value); } for (Class<? extends AttributedType> supportedType : configuration.getSupportedTypes().keySet()) { supportType(supportedType); if (Relationship.class.isAssignableFrom(supportedType)) { supportGlobalRelationship((Class<? extends Relationship>) supportedType); } } for (Class<? extends AttributedType> unsupportedType : configuration.getUnsupportedTypes().keySet()) { unsupportType(unsupportedType); } for (ContextInitializer contextInitializer : configuration.getContextInitializers()) { addContextInitializer(contextInitializer); } supportAttributes(configuration.supportsAttribute()); supportCredentials(configuration.supportsCredential()); supportPermissions(configuration.supportsPermissions()); return this; }
storeConfig.addCredentialHandler(loadClass(alternativeModule, typeName)); } catch (ClassNotFoundException e) { throw new RuntimeException("Could not find type [" + typeName + "].", e);
@SuppressWarnings({ "unchecked", "rawtypes" }) private void configureCredentialHandlers(OperationContext context, ModelNode identityStore, IdentityStoreConfigurationBuilder<?, ?> storeConfig) throws OperationFailedException { if (identityStore.hasDefined(IDENTITY_STORE_CREDENTIAL_HANDLER.getName())) { for (Property credentialHandler : identityStore.get(IDENTITY_STORE_CREDENTIAL_HANDLER.getName()).asPropertyList()) { ModelNode classNameNode = CredentialHandlerResourceDefinition.CLASS_NAME .resolveModelAttribute(context, credentialHandler.getValue()); ModelNode codeNode = CredentialHandlerResourceDefinition.CODE .resolveModelAttribute(context, credentialHandler.getValue()); ModelNode moduleNode = CredentialHandlerResourceDefinition.MODULE .resolveModelAttribute(context, credentialHandler.getValue()); String typeName; if (classNameNode.isDefined()) { typeName = classNameNode.asString(); } else if (codeNode.isDefined()) { typeName = CredentialTypeEnum.forType(codeNode.asString()); } else { throw ROOT_LOGGER.typeNotProvided(IDENTITY_STORE_CREDENTIAL_HANDLER.getName()); } storeConfig.addCredentialHandler(this.<CredentialHandler>loadClass(moduleNode, typeName)); } } }
@SuppressWarnings({ "unchecked", "rawtypes" }) private void configureCredentialHandlers(OperationContext context, ModelNode identityStore, IdentityStoreConfigurationBuilder<?, ?> storeConfig) throws OperationFailedException { if (identityStore.hasDefined(IDENTITY_STORE_CREDENTIAL_HANDLER.getName())) { for (Property credentialHandler : identityStore.get(IDENTITY_STORE_CREDENTIAL_HANDLER.getName()).asPropertyList()) { ModelNode classNameNode = CredentialHandlerResourceDefinition.CLASS_NAME .resolveModelAttribute(context, credentialHandler.getValue()); ModelNode codeNode = CredentialHandlerResourceDefinition.CODE .resolveModelAttribute(context, credentialHandler.getValue()); ModelNode moduleNode = CredentialHandlerResourceDefinition.MODULE .resolveModelAttribute(context, credentialHandler.getValue()); String typeName; if (classNameNode.isDefined()) { typeName = classNameNode.asString(); } else if (codeNode.isDefined()) { typeName = CredentialTypeEnum.forType(codeNode.asString()); } else { throw ROOT_LOGGER.typeNotProvided(IDENTITY_STORE_CREDENTIAL_HANDLER.getName()); } storeConfig.addCredentialHandler(this.<CredentialHandler>loadClass(moduleNode, typeName)); } } }