authentication

package
v0.0.8-GHES.3.13 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	*abs.RequestInformation
}

Request provides a wrapper around Kiota's abs.RequestInformation type

func (*Request) WithAPIVersion

func (r *Request) WithAPIVersion(version string)

WithAPIVersion sets the API version header for each request

func (*Request) WithDefaultAPIVersion

func (r *Request) WithDefaultAPIVersion()

WithDefaultAPIVersion sets the API version header to the default (the version used to generate the code) for each request

func (*Request) WithDefaultUserAgent

func (r *Request) WithDefaultUserAgent()

WithDefaultUserAgent sets the default User-Agent string for each request

func (*Request) WithTokenAuthentication

func (r *Request) WithTokenAuthentication(token string)

WithTokenAuthentication sets the Authorization header to the given token, prepended by the AuthType

func (*Request) WithUserAgent

func (r *Request) WithUserAgent(userAgent string)

WithUserAgent allows the caller to set the User-Agent string for each request

type TokenProvider

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

TokenProvider may use a token to authenticate each request. It also can be used to configure UserAgent strings, API Versions, and other request configuration. Note that GitHub App authentication is set at the client transport level. See the docs for pkg.NewApiClient for more.

func NewTokenProvider

func NewTokenProvider(options ...TokenProviderOption) *TokenProvider

NewTokenProvider creates an instance of TokenProvider with the specified token and options.

func (*TokenProvider) AuthenticateRequest

func (t *TokenProvider) AuthenticateRequest(context context.Context, request *abs.RequestInformation, additionalAuthenticationContext map[string]interface{}) error

AuthenticateRequest applies the default options for each request, then the user's options (if present in the TokenProvider). User options are guaranteed to be run in the order they were input.

type TokenProviderOption

type TokenProviderOption func(*TokenProvider, *Request)

TokenProviderOption provides a functional option for configuring a TokenProvider.

func WithAPIVersion

func WithAPIVersion(version string) TokenProviderOption

WithAPIVersion sets the API version header sent with each request.

func WithDefaultAPIVersion

func WithDefaultAPIVersion() TokenProviderOption

WithDefaultAPIVersion sets the API version header sent with each request.

func WithDefaultUserAgent

func WithDefaultUserAgent() TokenProviderOption

WithDefaultUserAgent sets the User-Agent string sent for requests to the default for this SDK.

func WithTokenAuthentication

func WithTokenAuthentication(token string) TokenProviderOption

WithTokenAuthentication sets the AuthorizationToken for each request to the given token.

func WithUserAgent

func WithUserAgent(userAgent string) TokenProviderOption

WithUserAgent sets the User-Agent string sent with each request.

Jump to

Keyboard shortcuts

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