Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(doc): update GroovyCustomClaimProvider example #1906

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 16 additions & 19 deletions docs/docs/configuration/authentifications/external.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@ This is the current implementation and the default one (doesn't break compatibil
````yaml
akhq:
security:
default-group: no-roles
default-group: admin
groups:
reader:
roles:
- topic/read
attributes:
topics-filter-regexp: [".*"]
no-roles:
roles: []
- role: reader
# patterns: [ ".*" ]
# clusters: [ ".*" ]
ldap: # LDAP users/groups to AKHQ groups mapping
oidc: # OIDC users/groups to AKHQ groups mapping
header-auth: # header authentication users/groups to AKHQ groups mapping
Expand Down Expand Up @@ -101,23 +98,26 @@ akhq:
groovy:
enabled: true
file: |
package org.akhq.utils;
package org.akhq.models.security;
class GroovyCustomClaimProvider implements ClaimProvider {
@Override
ClaimResponse generateClaim(ClaimRequest request) {
ClaimResponse response = ClaimResponse.builder().build()
response.roles = ["topic/read"]
response.topicsFilterRegexp: [".*"]
response.connectsFilterRegexp: [".*"]
response.consumerGroupsFilterRegexp: [".*"]
return response
String filterRegexp = request.groups.collect {
'^' + it + '\\..*'
}.join('|')
def groups = [
"reader": [
new org.akhq.configs.security.Group(role: "reader", patterns: [filterRegexp]),
]
]
return ClaimResponse.builder().groups(groups).build();
}
}
groups: # anything set here will not be used
````
``akhq.security.groovy.file`` must be a groovy class that implements the interface ClaimProvider :
````java
package org.akhq.utils;
package org.akhq.models.securitys;
public interface ClaimProvider {
ClaimResponse generateClaim(ClaimRequest request);
}
Expand All @@ -136,9 +136,6 @@ public class ClaimRequest {
}

public class ClaimResponse {
private List<String> roles;
private List<String> topicsFilterRegexp;
private List<String> connectsFilterRegexp;
private List<String> consumerGroupsFilterRegexp;
private Map<String, List<Group>> groups;
}
````
Loading