summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/clamp/clds/service/SecureServiceBase.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/onap/clamp/clds/service/SecureServiceBase.java')
-rw-r--r--src/main/java/org/onap/clamp/clds/service/SecureServiceBase.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/main/java/org/onap/clamp/clds/service/SecureServiceBase.java b/src/main/java/org/onap/clamp/clds/service/SecureServiceBase.java
index 522f682b7..f65308903 100644
--- a/src/main/java/org/onap/clamp/clds/service/SecureServiceBase.java
+++ b/src/main/java/org/onap/clamp/clds/service/SecureServiceBase.java
@@ -53,7 +53,7 @@ public abstract class SecureServiceBase {
/**
* Get the userId from AAF/CSP.
*
- * @return
+ * @return user ID
*/
public String getUserId() {
return getUserName();
@@ -62,7 +62,7 @@ public abstract class SecureServiceBase {
/**
* Get the Full name.
*
- * @return
+ * @return user name
*/
public String getUserName() {
String name = userNameHandler.retrieveUserName(securityContext);
@@ -76,7 +76,7 @@ public abstract class SecureServiceBase {
/**
* Get the principal name.
*
- * @return
+ * @return the principal name
*/
public String getPrincipalName() {
String principal = ((UserDetails)securityContext.getAuthentication().getPrincipal()).getUsername();
@@ -175,13 +175,16 @@ public abstract class SecureServiceBase {
// the rest of these don't seem to be required - isUserInRole method
// appears to take * as a wildcard
} else if (hasRole(inPermission.getKeyAllInstance())) {
- securityLogger.info("{} authorized because user has permission with * for instance: {}", getPrincipalName(), inPermission.getKey());
+ securityLogger.info("{} authorized because user has permission with * for instance: {}",
+ getPrincipalName(), inPermission.getKey());
authorized = true;
} else if (hasRole(inPermission.getKeyAllInstanceAction())) {
- securityLogger.info("{} authorized because user has permission with * for instance and * for action: {}", getPrincipalName(), inPermission.getKey());
+ securityLogger.info("{} authorized because user has permission with * for instance and * for action: {}",
+ getPrincipalName(), inPermission.getKey());
authorized = true;
} else if (hasRole(inPermission.getKeyAllAction())) {
- securityLogger.info("{} authorized because user has permission with * for action: {}", getPrincipalName(), inPermission.getKey());
+ securityLogger.info("{} authorized because user has permission with * for action: {}",
+ getPrincipalName(), inPermission.getKey());
authorized = true;
} else {
throw new NotAuthorizedException("");
@@ -196,8 +199,9 @@ public abstract class SecureServiceBase {
}
for (GrantedAuthority auth : authentication.getAuthorities()) {
- if (role.equals(auth.getAuthority()))
+ if (role.equals(auth.getAuthority())) {
return true;
+ }
}
return false;