Skip to content

Role-Based Access Protection (The "Gatekeeper") #16

@Stelle83

Description

@Stelle83

Configure Spring Security to lock down the API routes based on the Roles I created.

Goal: Lock the doors based on the Role enum.
Tasks:

  • Create SecurityConfig class.

  • Define SecurityFilterChain.

  • Set up rules: .requestMatchers("/api/admin/**").hasRole("MANAGEMENT").

  • Enable BCrypt password encoding for the login process.
    -------**-

/api/projects/** -> Only PRODUCER or MANAGEMENT can POST.
/api/tasks/** -> EMPLOYEE can only PATCH their own tasks.
/api/public/** -> Everyone (including VISITOR) can GET.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions