Browse Source

增加权限配置

tags/1.1.0
shaozhuguang 5 years ago
parent
commit
eadcfff96d
1 changed files with 19 additions and 3 deletions
  1. +19
    -3
      source/manager/ump-service/src/main/java/com/jd/blockchain/ump/service/SecurityServiceHandler.java

+ 19
- 3
source/manager/ump-service/src/main/java/com/jd/blockchain/ump/service/SecurityServiceHandler.java View File

@@ -49,9 +49,25 @@ public class SecurityServiceHandler implements SecurityService {


if (roles.length() > 0) { if (roles.length() > 0) {





securityConfigs.add(propBuild(UmpConstant.SECURITY_ROLES, roles));

String[] rolesArray = roles.split(",");
for (String role : rolesArray) {
String roleRealm = role.trim();
String roleLedgerKey = String.format(UmpConstant.SECURITY_ROLES_PRIVILEGES_LEDGER_FORMAT, roleRealm);
String roleLedgerValue = currentProps.getProperty(roleLedgerKey, "");
securityConfigs.add(propBuild(roleLedgerKey, roleLedgerValue));

String roleTxKey = String.format(UmpConstant.SECURITY_ROLES_PRIVILEGES_TX_FORMAT, roleRealm);
String roleTxValue = currentProps.getProperty(roleTxKey, "");
securityConfigs.add(propBuild(roleTxKey, roleTxValue));
}
} else {
throw new IllegalStateException("Can not find Properties from security.config");
} }
} }

private String propBuild(String key, String value) {
return key + "=" + value;
}
} }

Loading…
Cancel
Save