Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

idea: declarative token validation #31

Closed
bobbyrullo opened this issue Aug 17, 2015 · 1 comment
Closed

idea: declarative token validation #31

bobbyrullo opened this issue Aug 17, 2015 · 1 comment

Comments

@bobbyrullo
Copy link
Contributor

Issue by sym3tri
Tuesday Jun 30, 2015 at 19:45 GMT
Originally opened as https://github.com/coreos-inc/auth/issues/281


I've encountered jwt claim parsing/validation code very frequently. Just an idea, but maybe we create a generic way to declaratively "validate" tokens by ensuring a set of claims/values. I kinda want a function I can call like:

var (
  ErrorClaimMissing = ...
  ErrorClaimMatchFailure = ...
  ErrorClaimCheckInvalidType = ...
  ...
)

type ClaimCheck struct {
  name string
  value interface{} // must be a supported claim type
}

wantClaims := []ClaimCheck{
  // no value, just checks for existence
  ClaimCheck {
    name: "email",
  },
  // existence & equality check
  ClaimCheck {
    name: "aud",
    value: "some-clien-id",
  },
}

valid, err := jwt.HasExpected(wantClaims)
...

Thoughts?

@ericchiang
Copy link
Contributor

Dex no longer does any ID Token validation. Would be better for go-oidc.

palexster pushed a commit to palexster/dex that referenced this issue Nov 9, 2023
palexster pushed a commit to palexster/dex that referenced this issue Nov 9, 2023
palexster pushed a commit to palexster/dex that referenced this issue Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants