oauth2

package
v7.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApproveOption

type ApproveOption func(*ApproveOptions)

type ApproveOptions

type ApproveOptions struct {
	AuthorizationDetails string
	Scope                string
	// contains filtered or unexported fields
}

func (ApproveOptions) New

func (options ApproveOptions) New() *ApproveOptions

type AuthorizeOption

type AuthorizeOption func(*AuthorizeOptions)

type AuthorizeOptions

type AuthorizeOptions struct {
	ClientId             string
	RedirectUri          string
	ResponseType         string
	Scope                string
	State                string
	Nonce                string
	CodeChallenge        string
	CodeChallengeMethod  string
	Prompt               string
	MaxAge               int
	AuthorizationDetails string
	Resource             string
	Audience             string
	RequestUri           string
	// contains filtered or unexported fields
}

func (AuthorizeOptions) New

func (options AuthorizeOptions) New() *AuthorizeOptions

type AuthorizePostOption

type AuthorizePostOption func(*AuthorizePostOptions)

type AuthorizePostOptions

type AuthorizePostOptions struct {
	ClientId             string
	RedirectUri          string
	ResponseType         string
	Scope                string
	State                string
	Nonce                string
	CodeChallenge        string
	CodeChallengeMethod  string
	Prompt               string
	MaxAge               int
	AuthorizationDetails string
	Resource             string
	Audience             string
	RequestUri           string
	// contains filtered or unexported fields
}

func (AuthorizePostOptions) New

type CreateDeviceAuthorizationOption

type CreateDeviceAuthorizationOption func(*CreateDeviceAuthorizationOptions)

type CreateDeviceAuthorizationOptions

type CreateDeviceAuthorizationOptions struct {
	ClientId             string
	Scope                string
	AuthorizationDetails string
	Resource             string
	Audience             string
	// contains filtered or unexported fields
}

func (CreateDeviceAuthorizationOptions) New

type CreatePAROption

type CreatePAROption func(*CreatePAROptions)

type CreatePAROptions

type CreatePAROptions struct {
	Scope                string
	State                string
	Nonce                string
	CodeChallenge        string
	CodeChallengeMethod  string
	Prompt               string
	MaxAge               int
	AuthorizationDetails string
	Resource             string
	Audience             string
	// contains filtered or unexported fields
}

func (CreatePAROptions) New

func (options CreatePAROptions) New() *CreatePAROptions

type CreateTokenOption

type CreateTokenOption func(*CreateTokenOptions)

type CreateTokenOptions

type CreateTokenOptions struct {
	Code         string
	RefreshToken string
	DeviceCode   string
	ClientId     string
	ClientSecret string
	CodeVerifier string
	RedirectUri  string
	Resource     string
	Audience     string
	// contains filtered or unexported fields
}

func (CreateTokenOptions) New

func (options CreateTokenOptions) New() *CreateTokenOptions

type ListOrganizationsOption

type ListOrganizationsOption func(*ListOrganizationsOptions)

type ListOrganizationsOptions

type ListOrganizationsOptions struct {
	Limit  int
	Offset int
	Search string
	// contains filtered or unexported fields
}

func (ListOrganizationsOptions) New

type ListProjectsOption

type ListProjectsOption func(*ListProjectsOptions)

type ListProjectsOptions

type ListProjectsOptions struct {
	Limit  int
	Offset int
	Search string
	// contains filtered or unexported fields
}

func (ListProjectsOptions) New

type Oauth2

type Oauth2 struct {
	// contains filtered or unexported fields
}

Oauth2 service

func New

func New(clt client.Client) *Oauth2

func (*Oauth2) Approve

func (srv *Oauth2) Approve(GrantId string, optionalSetters ...ApproveOption) (*models.Oauth2Approve, error)

Approve approve an OAuth2 grant after the user gives consent. Returns the `redirectUrl` the end user should be sent to. The consent screen may optionally pass enriched `authorization_details` to record the concrete resources the user selected. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect.

func (*Oauth2) Authorize

func (srv *Oauth2) Authorize(optionalSetters ...AuthorizeOption) (*models.Oauth2Authorize, error)

Authorize begin the OAuth2 authorization flow. When called without a session, the user is redirected to the consent screen without grant ID. When called with a session, the redirect URL includes param for grant ID. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect.

func (*Oauth2) AuthorizePost

func (srv *Oauth2) AuthorizePost(optionalSetters ...AuthorizePostOption) (*models.Oauth2Authorize, error)

AuthorizePost begin the OAuth2 authorization flow. When called without a session, the user is redirected to the consent screen without grant ID. When called with a session, the redirect URL includes param for grant ID. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect.

func (*Oauth2) CreateDeviceAuthorization

func (srv *Oauth2) CreateDeviceAuthorization(optionalSetters ...CreateDeviceAuthorizationOption) (*models.Oauth2DeviceAuthorization, error)

CreateDeviceAuthorization start the OAuth2 Device Authorization Grant. Returns the device code, user code, verification URL, expiration, and polling interval.

func (*Oauth2) CreateGrant

func (srv *Oauth2) CreateGrant(UserCode string) (*models.Oauth2Grant, error)

CreateGrant exchange a device flow user code for an OAuth2 grant. The authenticated user is bound to the pending grant. Pass the returned grant ID to the get grant endpoint to render the consent screen, then to the approve or reject endpoint to complete the flow.

func (*Oauth2) CreatePAR

func (srv *Oauth2) CreatePAR(ClientId string, RedirectUri string, ResponseType string, optionalSetters ...CreatePAROption) (*models.Oauth2PAR, error)

CreatePAR store an OAuth2 authorization request server-side and receive a short-lived request_uri handle for the authorize endpoint.

func (*Oauth2) CreateToken

func (srv *Oauth2) CreateToken(GrantType string, optionalSetters ...CreateTokenOption) (*models.Oauth2Token, error)

CreateToken exchange an OAuth2 authorization code, refresh token, or device code for access and refresh tokens.

func (*Oauth2) GetGrant

func (srv *Oauth2) GetGrant(GrantId string) (*models.Oauth2Grant, error)

GetGrant get an OAuth2 grant by its ID. Used by the consent screen to display the details of the authorization the user is being asked to approve. A grant can only be read by the user it belongs to, or by server SDK.

func (*Oauth2) ListOrganizations

func (srv *Oauth2) ListOrganizations(optionalSetters ...ListOrganizationsOption) (*models.Oauth2OrganizationList, error)

ListOrganizations list the organizations the OAuth2 access token can access. Resolves the token's `organization` authorization details, expanding the `*` wildcard into the concrete set of organizations the user can see.

func (*Oauth2) ListProjects

func (srv *Oauth2) ListProjects(optionalSetters ...ListProjectsOption) (*models.Oauth2ProjectList, error)

ListProjects list the projects the OAuth2 access token can access. Resolves the token's `project` authorization details, expanding the `*` wildcard into the concrete set of projects the user can see.

func (*Oauth2) Reject

func (srv *Oauth2) Reject(GrantId string) (*models.Oauth2Reject, error)

Reject reject an OAuth2 grant when the user denies consent. Returns the `redirectUrl` the end user should be sent to with an `access_denied` error. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect.

func (*Oauth2) Revoke

func (srv *Oauth2) Revoke(Token string, optionalSetters ...RevokeOption) (*interface{}, error)

Revoke revoke an OAuth2 access token or refresh token.

func (*Oauth2) WithApproveAuthorizationDetails

func (srv *Oauth2) WithApproveAuthorizationDetails(v string) ApproveOption

func (*Oauth2) WithApproveScope

func (srv *Oauth2) WithApproveScope(v string) ApproveOption

func (*Oauth2) WithAuthorizeAudience

func (srv *Oauth2) WithAuthorizeAudience(v string) AuthorizeOption

func (*Oauth2) WithAuthorizeAuthorizationDetails

func (srv *Oauth2) WithAuthorizeAuthorizationDetails(v string) AuthorizeOption

func (*Oauth2) WithAuthorizeClientId

func (srv *Oauth2) WithAuthorizeClientId(v string) AuthorizeOption

func (*Oauth2) WithAuthorizeCodeChallenge

func (srv *Oauth2) WithAuthorizeCodeChallenge(v string) AuthorizeOption

func (*Oauth2) WithAuthorizeCodeChallengeMethod

func (srv *Oauth2) WithAuthorizeCodeChallengeMethod(v string) AuthorizeOption

func (*Oauth2) WithAuthorizeMaxAge

func (srv *Oauth2) WithAuthorizeMaxAge(v int) AuthorizeOption

func (*Oauth2) WithAuthorizeNonce

func (srv *Oauth2) WithAuthorizeNonce(v string) AuthorizeOption

func (*Oauth2) WithAuthorizePostAudience

func (srv *Oauth2) WithAuthorizePostAudience(v string) AuthorizePostOption

func (*Oauth2) WithAuthorizePostAuthorizationDetails

func (srv *Oauth2) WithAuthorizePostAuthorizationDetails(v string) AuthorizePostOption

func (*Oauth2) WithAuthorizePostClientId

func (srv *Oauth2) WithAuthorizePostClientId(v string) AuthorizePostOption

func (*Oauth2) WithAuthorizePostCodeChallenge

func (srv *Oauth2) WithAuthorizePostCodeChallenge(v string) AuthorizePostOption

func (*Oauth2) WithAuthorizePostCodeChallengeMethod

func (srv *Oauth2) WithAuthorizePostCodeChallengeMethod(v string) AuthorizePostOption

func (*Oauth2) WithAuthorizePostMaxAge

func (srv *Oauth2) WithAuthorizePostMaxAge(v int) AuthorizePostOption

func (*Oauth2) WithAuthorizePostNonce

func (srv *Oauth2) WithAuthorizePostNonce(v string) AuthorizePostOption

func (*Oauth2) WithAuthorizePostPrompt

func (srv *Oauth2) WithAuthorizePostPrompt(v string) AuthorizePostOption

func (*Oauth2) WithAuthorizePostRedirectUri

func (srv *Oauth2) WithAuthorizePostRedirectUri(v string) AuthorizePostOption

func (*Oauth2) WithAuthorizePostRequestUri

func (srv *Oauth2) WithAuthorizePostRequestUri(v string) AuthorizePostOption

func (*Oauth2) WithAuthorizePostResource

func (srv *Oauth2) WithAuthorizePostResource(v string) AuthorizePostOption

func (*Oauth2) WithAuthorizePostResponseType

func (srv *Oauth2) WithAuthorizePostResponseType(v string) AuthorizePostOption

func (*Oauth2) WithAuthorizePostScope

func (srv *Oauth2) WithAuthorizePostScope(v string) AuthorizePostOption

func (*Oauth2) WithAuthorizePostState

func (srv *Oauth2) WithAuthorizePostState(v string) AuthorizePostOption

func (*Oauth2) WithAuthorizePrompt

func (srv *Oauth2) WithAuthorizePrompt(v string) AuthorizeOption

func (*Oauth2) WithAuthorizeRedirectUri

func (srv *Oauth2) WithAuthorizeRedirectUri(v string) AuthorizeOption

func (*Oauth2) WithAuthorizeRequestUri

func (srv *Oauth2) WithAuthorizeRequestUri(v string) AuthorizeOption

func (*Oauth2) WithAuthorizeResource

func (srv *Oauth2) WithAuthorizeResource(v string) AuthorizeOption

func (*Oauth2) WithAuthorizeResponseType

func (srv *Oauth2) WithAuthorizeResponseType(v string) AuthorizeOption

func (*Oauth2) WithAuthorizeScope

func (srv *Oauth2) WithAuthorizeScope(v string) AuthorizeOption

func (*Oauth2) WithAuthorizeState

func (srv *Oauth2) WithAuthorizeState(v string) AuthorizeOption

func (*Oauth2) WithCreateDeviceAuthorizationAudience

func (srv *Oauth2) WithCreateDeviceAuthorizationAudience(v string) CreateDeviceAuthorizationOption

func (*Oauth2) WithCreateDeviceAuthorizationAuthorizationDetails

func (srv *Oauth2) WithCreateDeviceAuthorizationAuthorizationDetails(v string) CreateDeviceAuthorizationOption

func (*Oauth2) WithCreateDeviceAuthorizationClientId

func (srv *Oauth2) WithCreateDeviceAuthorizationClientId(v string) CreateDeviceAuthorizationOption

func (*Oauth2) WithCreateDeviceAuthorizationResource

func (srv *Oauth2) WithCreateDeviceAuthorizationResource(v string) CreateDeviceAuthorizationOption

func (*Oauth2) WithCreateDeviceAuthorizationScope

func (srv *Oauth2) WithCreateDeviceAuthorizationScope(v string) CreateDeviceAuthorizationOption

func (*Oauth2) WithCreatePARAudience

func (srv *Oauth2) WithCreatePARAudience(v string) CreatePAROption

func (*Oauth2) WithCreatePARAuthorizationDetails

func (srv *Oauth2) WithCreatePARAuthorizationDetails(v string) CreatePAROption

func (*Oauth2) WithCreatePARCodeChallenge

func (srv *Oauth2) WithCreatePARCodeChallenge(v string) CreatePAROption

func (*Oauth2) WithCreatePARCodeChallengeMethod

func (srv *Oauth2) WithCreatePARCodeChallengeMethod(v string) CreatePAROption

func (*Oauth2) WithCreatePARMaxAge

func (srv *Oauth2) WithCreatePARMaxAge(v int) CreatePAROption

func (*Oauth2) WithCreatePARNonce

func (srv *Oauth2) WithCreatePARNonce(v string) CreatePAROption

func (*Oauth2) WithCreatePARPrompt

func (srv *Oauth2) WithCreatePARPrompt(v string) CreatePAROption

func (*Oauth2) WithCreatePARResource

func (srv *Oauth2) WithCreatePARResource(v string) CreatePAROption

func (*Oauth2) WithCreatePARScope

func (srv *Oauth2) WithCreatePARScope(v string) CreatePAROption

func (*Oauth2) WithCreatePARState

func (srv *Oauth2) WithCreatePARState(v string) CreatePAROption

func (*Oauth2) WithCreateTokenAudience

func (srv *Oauth2) WithCreateTokenAudience(v string) CreateTokenOption

func (*Oauth2) WithCreateTokenClientId

func (srv *Oauth2) WithCreateTokenClientId(v string) CreateTokenOption

func (*Oauth2) WithCreateTokenClientSecret

func (srv *Oauth2) WithCreateTokenClientSecret(v string) CreateTokenOption

func (*Oauth2) WithCreateTokenCode

func (srv *Oauth2) WithCreateTokenCode(v string) CreateTokenOption

func (*Oauth2) WithCreateTokenCodeVerifier

func (srv *Oauth2) WithCreateTokenCodeVerifier(v string) CreateTokenOption

func (*Oauth2) WithCreateTokenDeviceCode

func (srv *Oauth2) WithCreateTokenDeviceCode(v string) CreateTokenOption

func (*Oauth2) WithCreateTokenRedirectUri

func (srv *Oauth2) WithCreateTokenRedirectUri(v string) CreateTokenOption

func (*Oauth2) WithCreateTokenRefreshToken

func (srv *Oauth2) WithCreateTokenRefreshToken(v string) CreateTokenOption

func (*Oauth2) WithCreateTokenResource

func (srv *Oauth2) WithCreateTokenResource(v string) CreateTokenOption

func (*Oauth2) WithListOrganizationsLimit

func (srv *Oauth2) WithListOrganizationsLimit(v int) ListOrganizationsOption

func (*Oauth2) WithListOrganizationsOffset

func (srv *Oauth2) WithListOrganizationsOffset(v int) ListOrganizationsOption

func (*Oauth2) WithListOrganizationsSearch

func (srv *Oauth2) WithListOrganizationsSearch(v string) ListOrganizationsOption

func (*Oauth2) WithListProjectsLimit

func (srv *Oauth2) WithListProjectsLimit(v int) ListProjectsOption

func (*Oauth2) WithListProjectsOffset

func (srv *Oauth2) WithListProjectsOffset(v int) ListProjectsOption

func (*Oauth2) WithListProjectsSearch

func (srv *Oauth2) WithListProjectsSearch(v string) ListProjectsOption

func (*Oauth2) WithRevokeClientId

func (srv *Oauth2) WithRevokeClientId(v string) RevokeOption

func (*Oauth2) WithRevokeClientSecret

func (srv *Oauth2) WithRevokeClientSecret(v string) RevokeOption

func (*Oauth2) WithRevokeTokenTypeHint

func (srv *Oauth2) WithRevokeTokenTypeHint(v string) RevokeOption

type RevokeOption

type RevokeOption func(*RevokeOptions)

type RevokeOptions

type RevokeOptions struct {
	TokenTypeHint string
	ClientId      string
	ClientSecret  string
	// contains filtered or unexported fields
}

func (RevokeOptions) New

func (options RevokeOptions) New() *RevokeOptions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL