Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

a fully-featured oauth2 client library

License

NotificationsYou must be signed in to change notification settings

vdbulcke/oauthx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WARNING: 🚧 still under construction 🚧

implements the following standards:

  • rfc6749/openid-connect-core: OAuth2/OIDC Authorization code flow
  • rfc7636: PKCE andnone auth method
  • rfc6772: OAuth2 Token Introspection
  • draft-ietf-oauth-jwt-introspection-response-03: JWT Response for OAuth Token Introspection
  • rfc7009: OAuth2 Token Revocation
  • rfc8414: OAuth 2.0 Authorization Server Metadata
  • rfc6749: OAuth2 RefreshToken
  • rfc6749:client_secret_basic,client_secret_post auth method
  • rfc7523: OAuth2private_key_jwt
  • rfc9101: JAR (request= jwt parameter)
  • rfc9126: Pushed Authorization Request (request_uri parameter)
  • rfc9396: RAR (authorization_details)
  • openid-connect-core: 3.1.3.7. ID Token Validation
  • openid-connect-core: 3.1.3.8. Access Token Validation
  • openid-connect-core: 5.5. Requesting Claims using the "claims" Request Parameterclaims=
  • openid-connect-core: 5.3. UserInfo Endpoint
  • openid-connect-core: 5.1. Standard Claims
  • openid-connect-discovery:/.well-known/openid-configuration
  • openid-connect-rpinitiated: RP initiated logout (endSession)

Documentation

Seegodoc ordoc dir.

Feature Examples

Creating a OAuthClient with builtin AuthMethod

Builtin AuthMethod:

  • none (default)
  • client_secret_basic
  • client_secret_post
  • private_key_jwt

SeeGetting Started example for more info

You can also create your own auth method by implementing a simple interface, seeCustom Auth Method foran example implementation of Bearer Token Auth Method for token introspection.

Openid Connect Authorization Code Flow example

SeeAuthorization Code Flow example for a sampleimplementation of the authorization code flow using with go standard http handler, id_token validation, userinfo call.

Other flows

PAR (rfc9126)/JAR (rfc9101)/RAR (rfc9396) example

This library provides ergonomic api for adding support for Pushed Authorization Request, Jwt-secured Authorization Request (request= jwt),Rich Authotization Request (authorization_details) in your authorization request by adding extra options to youroauthx.AuthZRequest.

SeePAR RAR JAR example for more info.

Http: client, tracing, custom header, custom error, response limit

This library has first class support for adding tracing header (and arbitrary headers) to http requests viacontext.Context.

It is encouraged to provide your own instance*http.Client with options.

Http and unmarshalling errors are returned using a customerror (*oauthx.HttpErr) that includes http response code, http response header, andhttp response body. It also as a builtin support for OAuth2 rfc6749 standard error.

Inspired bytigerbeetle's Tiger Style this library has http response sizelimits (defaultoauthx.LIMIT_HTTP_RESP_BODY_MAX_SIZE_BYTES) that you can override by usingoauthx.WellKnownWithHttpClient() andoauthx.WithHttpClientWithLimitoptions for fetching the wellknown metadata, and the oauth client respectively.

Seehttp tunning for more info.

Tiger Style

This library is inspired bytigerbeetle's Tiger Style and implements someof the features, such as assertions and limits (on http responses).

The library has several assertion on input parameters, and will print as stacktrace onstderr then panic if one assertion fails (for examplepassingnil pointer as input).

Plumbing and Porcelain

Inspired bygit, this library provides ergonomic "porcelain" api (it isrecommended to only use the "procelain" function), but it also exposes its internal "plumbing" functions.

All the "plumbing" function are prefixed withPlumbing (for examplePlumbingDoHttpPARRequest).Plumbing functions can be used if you want to make your own http request, and parsing the http response.

other features

  • Supports ID Token encryption (Nested JWT), and/or signed
  • Builtin support for Remote Jwks Uri (with caching)
  • Support Userinfo encryption and/or signed (jwt) or JSON
  • Support Introspection encryption and/or signed (jwt) or JSON

Inspired by


[8]ページ先頭

©2009-2025 Movatter.jp