use of org.apache.nifi.registry.security.authorization.ManagedAuthorizer in project nifi-registry by apache.
the class AuthorizerCapabilityDetection method isConfigurableUserGroupProvider.
public static boolean isConfigurableUserGroupProvider(final Authorizer authorizer) {
if (!isManagedAuthorizer(authorizer)) {
return false;
}
final ManagedAuthorizer managedAuthorizer = (ManagedAuthorizer) authorizer;
final AccessPolicyProvider accessPolicyProvider = managedAuthorizer.getAccessPolicyProvider();
return accessPolicyProvider.getUserGroupProvider() instanceof ConfigurableUserGroupProvider;
}
use of org.apache.nifi.registry.security.authorization.ManagedAuthorizer in project nifi-registry by apache.
the class AuthorizerCapabilityDetection method isGroupConfigurable.
public static boolean isGroupConfigurable(final Authorizer authorizer, final Group group) {
if (!isConfigurableUserGroupProvider(authorizer)) {
return false;
}
final ManagedAuthorizer managedAuthorizer = (ManagedAuthorizer) authorizer;
final ConfigurableUserGroupProvider configurableUserGroupProvider = (ConfigurableUserGroupProvider) managedAuthorizer.getAccessPolicyProvider().getUserGroupProvider();
return configurableUserGroupProvider.isConfigurable(group);
}
use of org.apache.nifi.registry.security.authorization.ManagedAuthorizer in project nifi-registry by apache.
the class AuthorizerCapabilityDetection method isUserConfigurable.
public static boolean isUserConfigurable(final Authorizer authorizer, final User user) {
if (!isConfigurableUserGroupProvider(authorizer)) {
return false;
}
final ManagedAuthorizer managedAuthorizer = (ManagedAuthorizer) authorizer;
final ConfigurableUserGroupProvider configurableUserGroupProvider = (ConfigurableUserGroupProvider) managedAuthorizer.getAccessPolicyProvider().getUserGroupProvider();
return configurableUserGroupProvider.isConfigurable(user);
}
use of org.apache.nifi.registry.security.authorization.ManagedAuthorizer in project nifi-registry by apache.
the class AuthorizerCapabilityDetection method isAccessPolicyConfigurable.
public static boolean isAccessPolicyConfigurable(final Authorizer authorizer, final AccessPolicy accessPolicy) {
if (!isConfigurableAccessPolicyProvider(authorizer)) {
return false;
}
final ManagedAuthorizer managedAuthorizer = (ManagedAuthorizer) authorizer;
final ConfigurableAccessPolicyProvider configurableAccessPolicyProvider = (ConfigurableAccessPolicyProvider) managedAuthorizer.getAccessPolicyProvider();
return configurableAccessPolicyProvider.isConfigurable(accessPolicy);
}
use of org.apache.nifi.registry.security.authorization.ManagedAuthorizer in project nifi-registry by apache.
the class IdentityAuthenticationProvider method getUserGroups.
private static Set<String> getUserGroups(final Authorizer authorizer, final String userIdentity) {
if (authorizer instanceof ManagedAuthorizer) {
final ManagedAuthorizer managedAuthorizer = (ManagedAuthorizer) authorizer;
final UserGroupProvider userGroupProvider = managedAuthorizer.getAccessPolicyProvider().getUserGroupProvider();
final UserAndGroups userAndGroups = userGroupProvider.getUserAndGroups(userIdentity);
final Set<Group> userGroups = userAndGroups.getGroups();
if (userGroups == null || userGroups.isEmpty()) {
return Collections.emptySet();
} else {
return userAndGroups.getGroups().stream().map(Group::getName).collect(Collectors.toSet());
}
} else {
return null;
}
}
Aggregations