Skip to content

Commit 3928862

Browse files
authored
RoleContainer support added (helidon-io#4271)
RoleContainer support added Signed-off-by: David Kral <david.k.kral@oracle.com>
1 parent fc540cf commit 3928862

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

security/abac/role/src/main/java/io/helidon/security/abac/role/RoleValidator.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2021 Oracle and/or its affiliates.
2+
* Copyright (c) 2018, 2022 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -116,6 +116,18 @@ public RoleConfig fromAnnotations(EndpointConfig endpointConfig) {
116116
}
117117
builder.permitAll(false);
118118
builder.denyAll(false);
119+
} else if (annotation instanceof RolesContainer container) {
120+
for (Roles role : container.value()) {
121+
if (role.subjectType() == SubjectType.USER) {
122+
roles.addAll(Arrays.asList(role.value()));
123+
} else {
124+
serviceRoles.addAll(Arrays.asList(role.value()));
125+
}
126+
}
127+
if (container.value().length != 0) {
128+
builder.permitAll(false);
129+
builder.denyAll(false);
130+
}
119131
} else if (annotation instanceof PermitAll) {
120132
builder.permitAll(true);
121133
builder.denyAll(false);

0 commit comments

Comments
 (0)