Skip to content

Commit

Permalink
oidc: add standard references
Browse files Browse the repository at this point in the history
- IDTokenClaims
- IntrospectionResponse
- UserInfo
  • Loading branch information
muhlemmer committed Mar 6, 2023
1 parent 54eae92 commit c7f1319
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/oidc/introspection.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ type ClientAssertionParams struct {
ClientAssertionType string `schema:"client_assertion_type"`
}

// IntrospectionResponse implements RFC 7662, section 2.2 and
// OpenID Connect Core 1.0, section 5.1 (UserInfo).
// https://www.rfc-editor.org/rfc/rfc7662.html#section-2.2.
// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims.
type IntrospectionResponse struct {
Active bool `json:"active"`
Scope SpaceDelimitedArray `json:"scope,omitempty"`
Expand Down
4 changes: 4 additions & 0 deletions pkg/oidc/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ func (a *AccessTokenClaims) UnmarshalJSON(data []byte) error {
return unmarshalJSONMulti(data, (*atcAlias)(a), &a.Claims)
}

// IDTokenClaims extends TokenClaims by further implementing
// OpenID Connect Core 1.0, sections 3.1.3.6 (Code flow),
// 3.2.2.10 (implicit), 3.3.2.11 (Hybrid) and 5.1 (UserInfo).
// https://openid.net/specs/openid-connect-core-1_0.html#toc
type IDTokenClaims struct {
TokenClaims
NotBefore Time `json:"nbf,omitempty"`
Expand Down
2 changes: 2 additions & 0 deletions pkg/oidc/userinfo.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package oidc

// UserInfo implements OpenID Connect Core 1.0, section 5.1.
// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims.
type UserInfo struct {
Subject string `json:"sub,omitempty"`
UserInfoProfile
Expand Down

0 comments on commit c7f1319

Please sign in to comment.