File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
services-api/src/main/java/io/scalecube/services/auth Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 44import java .util .Objects ;
55import java .util .Set ;
66
7+ /**
8+ * Service principal implementation of {@link Principal}. Provides role-based access control by
9+ * allowing checks against assigned roles and permissions.
10+ */
711public class ServicePrincipal implements Principal {
812
913 private final String role ;
@@ -17,7 +21,7 @@ public class ServicePrincipal implements Principal {
1721 */
1822 public ServicePrincipal (String role , Collection <String > permissions ) {
1923 this .role = role ;
20- this .permissions = Set .copyOf (permissions );
24+ this .permissions = permissions != null ? Set .copyOf (permissions ) : null ;
2125 }
2226
2327 @ Override
@@ -37,6 +41,6 @@ public Collection<String> permissions() {
3741
3842 @ Override
3943 public boolean hasPermission (String permission ) {
40- return permissions .contains (permission );
44+ return permissions != null && permissions .contains (permission );
4145 }
4246}
You can’t perform that action at this time.
0 commit comments