Build a Basic CRUD Application with Grails and Okta

Build a Basic CRUD Application with Grails and Okta

This tutorial adds secure controllers with Grails, OAuth 2.0, and Okta.

I am trying to integrate a grails application with okta. I followed this example in git hub where I see you as one of the contributor.

I have some isuues when I tried this. This example has a requirement where in I need to create/link the remote oauth2 account to local user account after successful authentication by okta. I do not want the overhead of maintaining a local user table again. Is there any way I can surpass this? And just go to the home controller page directly bases on the user roles. I am able to get the group claim in the okta jsonn output. How do I map this user response to Grails domain user/role class? Please help me with this

Could you please please help me with this?

This tutorial is super old and very out of date so it’s not going to be a great guide on how to integrate OAuth in a current Grails application. The tutorial was written as a server-side web application that assumed local user accounts would be created so that they could be linked to other object instances, which is generally the model that the Grails framework favored. Take a look at the Authentication section of the Grails documentation.

This doc page for the Spring Security Core Open ID plugin shows the use case you are asking about. Look under the 3.2 Plain OpenID header.

Grails is built on Spring, so you can use Spring Security as well. Spring has a lot of handy annotations, such as @PreAuthorize that you can use to implement method-level security based on OAuth 2.0 and OIDC. But this will require that you have Okta (or another OAuth 2.0 and OIDC provider) properly configured.

Here’s another link that might help you with Grails and Spring Security. It’s also, unfortunately, pretty old. 2013.

I believe we’ll be adding a new Grails tutorial soon that will update all of this.

Please let me know if that helps or if you need more info.


Hi Andrew, I want to mock okta login , do you have any examples on mocking okta login for running integration tests in grails? I integrated grails and okta with grails spring security oauth2 plugin