All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy