Comments (4)
Hey @oliverpool
In our case we already have a unique id created and stored in the database, which we then use for the state. The stateFn was therefore was a simple option to provide a slightly more open possibility.
But I see what you try to achieve and passing the http request to the function seems a sensible solution to get the current state of the users in you application (e.g. requested page) before they get redirected to the OP.
I am open to a PR with a concrete proposal 😃
As addition to your second comment from the OIDC spec:
state
RECOMMENDED. Opaque value used to maintain state between the request and the callback. Typically, Cross-Site Request Forgery (CSRF, XSRF) mitigation is done by cryptographically binding the value of this parameter with a browser cookie.
If you pass a cookieHandler, the library will create an encrypted cookie to mitigate such attacks:
https://github.com/caos/oidc/blob/219ba4e038457f9db7877074f6760e53d559ddfc/example/client/app/app.go#L33-L38
from oidc.
In the end, I went using golang.org/x/oauth2.Config.AuthCodeURL(state)
directly.
Actually I switched to https://github.com/coreos/go-oidc, because of the IDToken.Claims which allows to unmarshal the user claims directly
from oidc.
I just realized that state
should be used to prevent csrf attacks: https://cs.opensource.google/go/x/oauth2/+/d3ed0bb2:oauth2.go;l=150
In this case, it might make sense to somehow generate and handle it automatically.
from oidc.
Sorry that we could not help. But thanks for the request anyway.
from oidc.
Related Issues (20)
- JWT Assertion payload does not match RFC example when generated with OIDC relying party HOT 8
- [Bug]: Client Assertion token request includes basic auth header HOT 3
- PKCE support is not enough HOT 1
- use trace id of external service HOT 2
- Allow custom forwarded header HOT 2
- [Bug]: client invalid signature when OIDC server is restarted HOT 2
- The automated release is failing 🚨
- [Bug]: nil pointer dereference in `crypto.BytesToPrivateKey` HOT 3
- Access to auto discovery configuration HOT 3
- Allow empty nonce from ID Tokens issued from Refresh Tokens HOT 10
- Support form_post OIDC response mode HOT 4
- Do not ignore all JWKS parsing errors HOT 1
- [Bug]: nil pointer dereference when not setting unauthorized handler HOT 2
- Switch to `log/slog` HOT 2
- [Bug]: The behavior of response_mode does not adhere to the guidelines HOT 2
- Support ``verification_url`` mispelling in the device auth response HOT 6
- Set IDTokenSigningAlgValuesSupported of DiscoveryConfiguration obtained by Discover when initializing RelyingParty. HOT 3
- Update to go-jose/v4 HOT 4
- add prometheus metrics for apis HOT 2
- JWT Profile Grant: return id_token if openid scope is set HOT 6
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 oidc.