com.uid2.shared.attest.RoleBasedJwtClaimValidator Maven / Gradle / Ivy
package com.uid2.shared.attest;
import com.uid2.shared.auth.Role;
import java.util.Set;
public class RoleBasedJwtClaimValidator {
private final Set requiredRoles;
public RoleBasedJwtClaimValidator(Set requiredRoles) {
this.requiredRoles = requiredRoles;
}
public Set getRequiredRoles() {
return requiredRoles;
}
public boolean hasRequiredRoles(JwtValidationResponse response) {
for (Role role : requiredRoles) {
if (!response.hasRole(role)) {
return false;
}
}
return true;
}
}