AuthorizeExchangeDsl

A Kotlin DSL to configure ServerHttpSecurity exchange authorization using idiomatic Kotlin code.

Author

Eleftheria Stein

Since

5.4

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
val anyExchange: ServerWebExchangeMatcher

Matches any exchange.

Link copied to clipboard
val authenticated: ReactiveAuthorizationManager<AuthorizationContext>

Require an authenticated user.

Link copied to clipboard
val denyAll: ReactiveAuthorizationManager<AuthorizationContext>

Deny access for everyone.

Link copied to clipboard
val permitAll: ReactiveAuthorizationManager<AuthorizationContext>

Allow access for anyone.

Functions

Link copied to clipboard
fun authorize(antPattern: String, access: ReactiveAuthorizationManager<AuthorizationContext> = authenticated)

Adds an exchange authorization rule for an endpoint matching the provided ant pattern.

fun authorize(matcher: ServerWebExchangeMatcher = ServerWebExchangeMatchers.anyExchange(), access: ReactiveAuthorizationManager<AuthorizationContext> = authenticated)

Adds an exchange authorization rule for an endpoint matching the provided matcher.

Link copied to clipboard
fun hasAnyAuthority(vararg authorities: String): ReactiveAuthorizationManager<AuthorizationContext>

Require any authority.

Link copied to clipboard
fun hasAnyRole(vararg roles: String): ReactiveAuthorizationManager<AuthorizationContext>

Require any specific role. This is a shortcut for hasAnyAuthority.

Link copied to clipboard
fun hasAuthority(authority: String): ReactiveAuthorizationManager<AuthorizationContext>

Require a specific authority.

Link copied to clipboard
fun hasIpAddress(ipAddress: String): ReactiveAuthorizationManager<AuthorizationContext>

Require a specific IP or range of IP addresses.

Link copied to clipboard
fun hasRole(role: String): ReactiveAuthorizationManager<AuthorizationContext>

Require a specific role. This is a shortcut for hasAuthority.