Skip to content

Instantly share code, notes, and snippets.

@brunapereira
Created January 9, 2020 22:43
Show Gist options
  • Select an option

  • Save brunapereira/dc8dbaf8ff589fdc59223dc3d5c95c5c to your computer and use it in GitHub Desktop.

Select an option

Save brunapereira/dc8dbaf8ff589fdc59223dc3d5c95c5c to your computer and use it in GitHub Desktop.
@Configuration
@EnableWebSecurity
@Order(1)
class FF4jSecurityConfig(private val properties: FF4JProperties): WebSecurityConfigurerAdapter() {
override fun configure(auth: AuthenticationManagerBuilder) {
auth.inMemoryAuthentication()
.withUser(properties.user)
.password("{noop}${properties.password}")
.roles(properties.role)
}
override fun configure(http: HttpSecurity) {
http.csrf().disable()
.authorizeRequests()
.antMatchers("/ff4j-web-console/**")
.hasRole("ADMIN")
.and()
.httpBasic()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment