Search in sources :

Example 1 with UserGroupProviderInitializationContext

use of org.apache.nifi.registry.security.authorization.UserGroupProviderInitializationContext in project nifi-registry by apache.

the class FileAuthorizer method initialize.

@Override
public void initialize(final AuthorizerInitializationContext initializationContext) throws SecurityProviderCreationException {
    // initialize the user group provider
    userGroupProvider.initialize(new UserGroupProviderInitializationContext() {

        @Override
        public String getIdentifier() {
            return FILE_USER_GROUP_PROVIDER_ID;
        }

        @Override
        public UserGroupProviderLookup getUserGroupProviderLookup() {
            return (identifier) -> null;
        }
    });
    // initialize the access policy provider
    accessPolicyProvider.initialize(new AccessPolicyProviderInitializationContext() {

        @Override
        public String getIdentifier() {
            return FILE_ACCESS_POLICY_PROVIDER_ID;
        }

        @Override
        public UserGroupProviderLookup getUserGroupProviderLookup() {
            return (identifier) -> {
                if (FILE_USER_GROUP_PROVIDER_ID.equals(identifier)) {
                    return userGroupProvider;
                }
                return null;
            };
        }

        @Override
        public AccessPolicyProviderLookup getAccessPolicyProviderLookup() {
            return (identifier) -> null;
        }
    });
}
Also used : AccessPolicyProviderInitializationContext(org.apache.nifi.registry.security.authorization.AccessPolicyProviderInitializationContext) UserGroupProviderLookup(org.apache.nifi.registry.security.authorization.UserGroupProviderLookup) UserGroupProviderInitializationContext(org.apache.nifi.registry.security.authorization.UserGroupProviderInitializationContext) AccessPolicyProviderLookup(org.apache.nifi.registry.security.authorization.AccessPolicyProviderLookup)

Example 2 with UserGroupProviderInitializationContext

use of org.apache.nifi.registry.security.authorization.UserGroupProviderInitializationContext in project nifi-registry by apache.

the class LdapUserGroupProviderTest method setup.

@Before
public void setup() {
    final UserGroupProviderInitializationContext initializationContext = mock(UserGroupProviderInitializationContext.class);
    when(initializationContext.getIdentifier()).thenReturn("identifier");
    ldapUserGroupProvider = new LdapUserGroupProvider();
    ldapUserGroupProvider.setNiFiProperties(getNiFiProperties(new Properties()));
    ldapUserGroupProvider.initialize(initializationContext);
}
Also used : UserGroupProviderInitializationContext(org.apache.nifi.registry.security.authorization.UserGroupProviderInitializationContext) NiFiRegistryProperties(org.apache.nifi.registry.properties.NiFiRegistryProperties) Properties(java.util.Properties) Before(org.junit.Before)

Aggregations

UserGroupProviderInitializationContext (org.apache.nifi.registry.security.authorization.UserGroupProviderInitializationContext)2 Properties (java.util.Properties)1 NiFiRegistryProperties (org.apache.nifi.registry.properties.NiFiRegistryProperties)1 AccessPolicyProviderInitializationContext (org.apache.nifi.registry.security.authorization.AccessPolicyProviderInitializationContext)1 AccessPolicyProviderLookup (org.apache.nifi.registry.security.authorization.AccessPolicyProviderLookup)1 UserGroupProviderLookup (org.apache.nifi.registry.security.authorization.UserGroupProviderLookup)1 Before (org.junit.Before)1