com.xlrit.gears.server.security.internal.InternalAuthenticationConfigurer Maven / Gradle / Ivy
The newest version!
package com.xlrit.gears.server.security.internal;
import lombok.RequiredArgsConstructor;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.SecurityConfigurer;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.server.resource.web.authentication.BearerTokenAuthenticationFilter;
import org.springframework.security.web.DefaultSecurityFilterChain;
@RequiredArgsConstructor
class InternalAuthenticationConfigurer implements SecurityConfigurer {
private final BearerConverter converter;
@Override
public void init(HttpSecurity http) {
http.authenticationProvider(new InternalAuthenticationProvider(converter));
}
@Override
public void configure(HttpSecurity http) {
AuthenticationManager authenticationManager = http.getSharedObject(AuthenticationManager.class);
http.addFilter(new BearerTokenAuthenticationFilter(authenticationManager));
}
}