Comments (1)
Hi and thanks for using the Valve!
I didn't try specifically with Google or GitHub, but it should work with all OpenId compliant IDP, since they expose the "well-known" endpoint.
For example, Google's one is "https://accounts.google.com/.well-known/openid-configuration", and its jwks_uri
value is "https://www.googleapis.com/oauth2/v3/certs": this is the value to use for parameter issuerUrl
.
So, you can just configure the valve like this:
<Valve className="it.cosenonjaviste.security.jwt.valves.OidcJwtTokenValve"
issuerUrl="https://www.googleapis.com/oauth2/v3/certs"
expiresIn="30"
timeUnit="MINUTES" />
and it should work with token emitted by google. Certificates downloaded from "https://www.googleapis.com/oauth2/v3/certs" will be cached internally for 30 minutes.
This is the correct configuration if JWT emitted has a long duration. For example, on Salesforce or Keycloack, you can set JWT duration and you can use this valve easily like shown above.
However, I don't know how long a JWT emitted by Google is valid: if you cannot control its duration, maybe this is not the right approach. Usually, social login emit a token valid just for 3 minutes, where you have just time to gather some information from the token, then it expires and you cannot use it for further authentication.
In this case, what I usually do is to intercept the successful social login and emit another (private) JWT signed by me, so I can use the HmacJwtTokenValve
or RsaJwtTokenValve
, since I own secrets.
Let me know if this can help!
Cheers
from tomcat-jwt-security.
Related Issues (8)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tomcat-jwt-security.