OAuth 2.0 for Grails without Spring security
-
21-12-2019 - |
Frage
I am currently implementing Shiro-Authentication along with OAuth for Google SignIn. It all works great and lets me authenticate a gmail account against a users email in my database. My build config looks as follows:
//User roles and permissions
compile (":shiro:1.2.0") {
excludes "servlet-api"
excludes "shiro-quartz"
}
//Google SignIn
compile ":oauth:2.1.0"
The only issue I am having is that when google requests permission for my application, I get this:
When I was expecting something more like this:
It is clearly still using OAuth 1.0 and not 2.0. I have read many questions on here and the closest I have found is this Google consent screen not shown as expected .
The only issue with this implementation is that it uses Spring security and I am using Shiro. When I try use the spring plugin, I keep coming up against this issue when I try to compile it:
| Error The following artifacts could not be resolved: org.springframework.security:spring-security-core:jar:3.2.0.RC1, org.springframework.security:spring-security-web:jar:3.2.0.RC1: Could not find artifact org.springframework.security:spring-security-core:jar:3.2.0.RC1 in grailsCentral (http://repo.grails.org/grails/plugins)
| Run 'grails dependency-report' for further information.
IDEA hook: Grails not found!
| Error java.lang.NullPointerException
| Error at org.jetbrains.groovy.grails.rt.Agent$2.run(Agent.java:135)
| Error at java.lang.Thread.run(Thread.java:695)
Any tips or suggestions are greatly appreciated.
Cheers.
Lösung
I have create a sample grails application that uses oauth plugin
for google authentication
with oauth2
.
Have a try.
I have created a new java
file in src/java
as suggested here, and using this in my google configurations in Config.groovy
.
I have provided the full solution here.