use of com.google.api.AuthenticationRule in project toolkit by googleapis.
the class ProductServiceConfig method getAuthScopes.
/**
* Return a list of scopes for authentication.
*/
public List<String> getAuthScopes(Model model) {
Set<String> result = new TreeSet<>();
Service config = model.getServiceConfig();
Authentication auth = config.getAuthentication();
for (AuthenticationRule rule : auth.getRulesList()) {
// Scopes form a union and the union is used for down-scoping, so adding more scopes that
// are subsets of the others already in the union essentially has no effect.
// We are doing this for implementation simplicity so we don't have to compute which scopes
// are subsets of the others.
String scopesString = rule.getOauth().getCanonicalScopes();
for (String scope : scopesString.split(",")) {
result.add(scope.trim());
}
}
return new ArrayList<>(result);
}
use of com.google.api.AuthenticationRule in project toolkit by googleapis.
the class ProtoApiModel method getAuthScopes.
@Override
public List<String> getAuthScopes() {
Set<String> result = new TreeSet<>();
Service config = protoModel.getServiceConfig();
Authentication auth = config.getAuthentication();
for (AuthenticationRule rule : auth.getRulesList()) {
// Scopes form a union and the union is used for down-scoping, so adding more scopes that
// are subsets of the others already in the union essentially has no effect.
// We are doing this for implementation simplicity so we don't have to compute which scopes
// are subsets of the others.
String scopesString = rule.getOauth().getCanonicalScopes();
for (String scope : scopesString.split(",")) {
result.add(scope.trim());
}
}
return new ArrayList<>(result);
}
Aggregations