alts: migrate java proto map getter from get<field> to get<field>Map (#7522)

Migrate java proto map getter from get to getMap.

This is part of a set of changes to java proto map API described here: go/java-proto-maplike

More information: go/java-proto-maplike-getFooMap
This commit is contained in:
Chengyuan Zhang 2020-10-14 13:37:16 -07:00 committed by GitHub
parent 42555a86cd
commit 67b54608da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -34,7 +34,7 @@ public final class AltsAuthContext {
.setPeerServiceAccount(result.getPeerIdentity().getServiceAccount())
.setLocalServiceAccount(result.getLocalIdentity().getServiceAccount())
.setPeerRpcVersions(result.getPeerRpcVersions())
.putAllPeerAttributes(result.getPeerIdentity().getAttributes())
.putAllPeerAttributes(result.getPeerIdentity().getAttributesMap())
.build();
}

View File

@ -85,7 +85,7 @@ public class AuthorizationEngine {
*/
public AuthorizationEngine(RBAC rbacPolicy) {
Map<String, Expr> conditions = new LinkedHashMap<>();
for (Map.Entry<String, Policy> policy: rbacPolicy.getPolicies().entrySet()) {
for (Map.Entry<String, Policy> policy: rbacPolicy.getPoliciesMap().entrySet()) {
conditions.put(policy.getKey(), policy.getValue().getCondition());
}
allowEngine = (rbacPolicy.getAction() == Action.ALLOW)
@ -108,12 +108,12 @@ public class AuthorizationEngine {
"Invalid RBAC list, "
+ "must provide a RBAC with DENY action followed by a RBAC with ALLOW action. ");
Map<String, Expr> denyConditions = new LinkedHashMap<>();
for (Map.Entry<String, Policy> policy: denyPolicy.getPolicies().entrySet()) {
for (Map.Entry<String, Policy> policy: denyPolicy.getPoliciesMap().entrySet()) {
denyConditions.put(policy.getKey(), policy.getValue().getCondition());
}
denyEngine = new RbacEngine(Action.DENY, ImmutableMap.copyOf(denyConditions));
Map<String, Expr> allowConditions = new LinkedHashMap<>();
for (Map.Entry<String, Policy> policy: allowPolicy.getPolicies().entrySet()) {
for (Map.Entry<String, Policy> policy: allowPolicy.getPoliciesMap().entrySet()) {
allowConditions.put(policy.getKey(), policy.getValue().getCondition());
}
allowEngine = new RbacEngine(Action.ALLOW, ImmutableMap.copyOf(allowConditions));