Giter Site home page Giter Site logo

Comments (4)

livio-a avatar livio-a commented on May 17, 2024 1

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.

oliverpool avatar oliverpool commented on May 17, 2024 1

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.

oliverpool avatar oliverpool commented on May 17, 2024

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.

fforootd avatar fforootd commented on May 17, 2024

Sorry that we could not help. But thanks for the request anyway.

from oidc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.