Hi,
I am trying to implement OIDC with Spring Boot - Okta… I was able to run the application and everything is working fine…my question here was, is there any way to override the default login page of Spring Boot, where it will provide the link of okta which will take to the okta login page…
I need assistance on overriding/bypassing the default spring boot login page and upon hitting any of the app uri(s), it should take directly to the okta default login page…
please let me know if you need any additional info and any help is really appreciated.
I’m not sure how to do this. I did ask the Spring Security folks to add this as a feature last year, but I don’t think they ever did. They did think it was an interesting idea.
Hi @mraible,
thanks for looking into my issue…
I do see from the spring documentation of implementing custom login page in the websecurity configure method using
—> oauth2Login().loginPage("/oauth2/oktaLogin");
and then have a method to render the above realm…
But when I tried above, things are not working and not sure of whether we can implement the above scenario for my requirement…
Sorry, it was just a guess. I would recommend contacting the Spring Security team (maybe by posting your question on Stack Overflow) and seeing what they recommend.
Note that you can use Spring Boot’s OAuth support instead of OIDC and get the functionality you’re looking for. Add the following dependencies to your pom.xml:
Then create an Okta Web app and set the login redirect URI to https://localhost:8080/login. Then modify your app’s application.yml to have your settings:
ok…will try and let u know @mraible…
qq on that… you mean there is no need of overriding the WebSecurityConfigurerAdapter - configure method to authenticate the requests…?
@Configuration
//@EnableOAuth2Sso
public class SecurityConfig extends WebSecurityConfigurerAdapter {
If you want your whole app to be protected, you shouldn’t need a class that extends WebSecurityConfigurerAdapter. If you want to allow anonymous access to certain resources, then you will need this class.