Skip to content

add spring security DSL #304

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

Closed
wants to merge 5 commits into from
Closed

add spring security DSL #304

wants to merge 5 commits into from

Conversation

pull-vert
Copy link
Contributor

@pull-vert pull-vert commented Aug 27, 2020

  • Complete work of @jonasbark and @skivol, now using DSLs from spring-security 5.4
  • Add spring-security support for Spring MVC

fixes #16

For webFlux

webFlux {
    port = 0
    router {
        GET("/public-view") { ok().build() }
        GET("/view") { ok().build() }
    }

    security {
        authenticationManager = repoAuthenticationManager

        http {
            authorizeExchange {
                authorize("/public-view", permitAll)
                authorize("/view", hasRole("USER"))
            }
            httpBasic {}
        }
    }
}

For webMvc

webMvc {
    port = 0
    router {
        GET("/public-view") { ok().build() }
        GET("/view") { ok().build() }
    }

    security {
        authenticationManager = repoAuthenticationManager

        http {
            authorizeRequests {
                authorize("/public-view", permitAll)
                authorize("/view", hasRole("USER"))
            }
            httpBasic {}
        }
    }
}

@pull-vert pull-vert marked this pull request as draft September 4, 2020 12:12
@pull-vert pull-vert closed this Sep 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce a security { } DSL
1 participant