use of com.amplifyframework.core.model.auth.AuthorizationTypeIterator in project amplify-android by aws-amplify.
the class MultiAuthModeStrategy method authTypesFor.
@Override
public AuthorizationTypeIterator authTypesFor(@NonNull ModelSchema modelSchema, @NonNull ModelOperation operation) {
final List<AuthRule> applicableRules = new ArrayList<>();
Consumer<List<AuthRule>> filterAuthRules = authRules -> {
for (AuthRule rule : authRules) {
if (rule.getOperationsOrDefault().contains(operation)) {
applicableRules.add(rule);
}
}
};
filterAuthRules.accept(modelSchema.getAuthRules());
for (ModelField field : modelSchema.getFields().values()) {
filterAuthRules.accept(field.getAuthRules());
}
return new MultiAuthorizationTypeIterator(applicableRules);
}
Aggregations