Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RBAC #646

Merged
merged 11 commits into from
Jun 25, 2024
Merged

RBAC #646

merged 11 commits into from
Jun 25, 2024

Conversation

EmmanuelDemey
Copy link
Collaborator

No description provided.

@FBibonne
Copy link
Member

FBibonne commented Jun 12, 2024

Api proposal for Rbac :

    @Test
    void givenTheRoleShouldGrantPrivilege(){
        //GIVEN
        var roles=List.of("A_ROLE");
        //WHEN
        AccessPrivileges accessPrivileges = rbacService.computeRbac(roles);
        // THEN
        assertThat(accessPrivileges.isGranted(update).on(serie).withId("s1279")).isTrue();
    }

which should give for controlers : @PreAuthorize("canUpdateSerie(#seriesId)")

whose implementation (in class SecurityExpressionRootForBauhaus) would be :

public boolean canUpdateSerie(String serieId){
    return getAccessPrivileges(getStamp()).isGranted(update).on(serie).withId(serieId);
}

An method getAccessPrivilege :

    private AccessPrivilege getAccessPrivilege(){
        rbacService.computeRbac(userDecoder.fromPrincipal(methodSecurityExpressionRoot.getPrincipal()).get().roles());
    }

@FBibonne
Copy link
Member

commit #7366332f196accb4ad372564396c5e0388eeb5cc make a proposal for internal implementation from configuration maps deserialized from rbac.yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants