Skip to content

Commit

Permalink
YKI(Backend) Disable default authentication [deploy]
Browse files Browse the repository at this point in the history
  • Loading branch information
jrkkp committed Oct 31, 2024
1 parent c1fbace commit e762a2a
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.web.SecurityFilterChain;
Expand Down Expand Up @@ -31,4 +33,11 @@ public static HttpSecurity configCsrf(final HttpSecurity httpSecurity) throws Ex
configurer.csrfTokenRepository(csrfTokenRepository).csrfTokenRequestHandler(requestHandler)
);
}

@Bean
public AuthenticationManager noopAuthenticationManager() {
return authentication -> {
throw new AuthenticationServiceException("Authentication is disabled");
};
}
}

0 comments on commit e762a2a

Please sign in to comment.