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;
}
});
}
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);
}
Aggregations