Spring boot 1.5.x mvc login + okta login


I have an older application using spring boot 1.5 and classic login form that authenticates user against the database. Now, I would need to, in addition to existing login, add login with okta button.

I have tried adding another security configuration (with okta config, tested in standalone springboot application) and setting one url to be authenticated by okta. I was hoping it would just redirect to okta and let me login. It actually does that, but for all URLs.

I am pretty sure I need to customize things, but I am relatively new to oauth2 implementations, especially okta. I am looking at the examples (https://github.com/okta/samples-java-spring/tree/master/custom-login), but It will take time to figure out whats where.

If there is an example somewhere, I’d be happy if someone can point me in the right direction.

PS Is there a way to say, programmatically, go to okta and do a login? That would probably solve all my troubles.