o_auth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client for o auth API

func (*Client) SetTransport

func (a *Client) SetTransport(transport runtime.ClientTransport)

SetTransport changes the transport on the client

func (*Client) TokenGrant

  TokenGrant os auth2 access token generation endpoint

  <p>This endpoint requires all requests to have <code>Authorization</code> header set with <code>Basic</code> access authentication
			constructed from client id and client secret.</p>
			<p>This endpoint supports different <strong>grant types</strong>:</p><ol>
	 		<li>Grant Type == <code>client_credentials</code>:<br />
	 		&nbsp;&nbsp;&nbsp; This endpoint will check the client credentials provided through Authorization header.</li>
	 		<li>Grant Type == <code>password</code>:<br />
	 		&nbsp;&nbsp;&nbsp; The grant type to use for authenticating a user, whether it's by email / username and password combination
			or through platform.</li>
	 		<li>Grant Type == <code>refresh_token</code>:<br />
	 		&nbsp;&nbsp;&nbsp; Used to get a new access token for a valid refresh token.</li>
	 		<li>Grant Type == <code>authorization_code<code>:<br />
	 		&nbsp;&nbsp;&nbsp; It generates the user token by given the authorization
	 		code which generated in "/authorize" API response. It should also pass
	 		in the redirect_uri, which should be the same as generating the
	 		authorization code request.</li></ol>
	 		<p>For platform authentication, use grant type <code>password</code>.
	 		The <code>username</code> field would be in form of
	 		<code>platform:&lt;platform type&gt;</code>, for example
	 		<code>platform:steam</code> for Steam. For the <code>password</code>
	 		field, set it to the authentication/authorization ticket or token obtainable through the
	 		respective platform SDK after authenticated the user to the platform. Supported platforms:</p><ul>
			<li><strong>steam</strong> - use <code>platform:steam</code> as the username and use the authentication ticket obtained
			from Steam through the Steam SDK as the password.</li>
			<li><strong>ps4</strong> - use <code>platform:ps4</code> as the username and use the authorization code
			obtained from the PlayStation Network through a player PS4 unit as the password.</li>
			<li><strong>live</strong> - use <code>platform:live</code> as the username and use token obtained from
			Xbox Secure Token Service (XSTS) as the password.</li>
			<li><strong>oculus</strong> - use <code>platform:oculus</code> as the username and use the <code>user_id:nonce</code>
			as password obtained from Oculus through the Oculus SDK.</li></ul></p>
			<p>The access token and refresh token are in form of JWT token.
	 		An access token JWT contains data which structure is similar to the
	 		Response Class below, but without OAuth-related data. To verify a token, use the public keys
			obtained from the <code>/jwks</code> endpoint below.</p>

<h2>Access Token Content</h2> <p>Following is the access token’s content:</p> <ul> <li>

<p><strong>namespace</strong>. It is the namespace the token was generated from.</p>

</li> <li>

<p><strong>display_name</strong>. The display name of the sub. It is empty if the token is generated from the client credential</p>

</li> <li>

<p><strong>roles</strong>. The sub’s roles. It is empty if the token is generated from the client credential</p>

</li> <li>

<p><strong>permissions</strong>. The sub or aud’ permissions</p>

</li> <li>

<p><strong>bans</strong>. The sub’s list of bans. It is used by the IAM client for validating the token.</p>

</li> <li>

<p><strong>jflgs</strong>. It stands for Justice Flags. It is a special flag used for storing additional status information regarding the sub. It is implemented as a bit mask. Following explains what each bit represents:</p>

<ul>

<li><p>1: Email Address Verified</p></li>
<li><p>2: Phone Number Verified</p></li>
<li><p>4: Anonymous</p></li>

</ul> </li> <li>

<p><strong>aud</strong>. The aud is the client ID.</p>

</li> <li>

<p><strong>iat</strong>. The time the token issues at. It is in Epoch time format</p>

</li> <li>

<p><strong>exp</strong>. The time the token expires. It is in Epoch time format</p>

</li> <li>

<p><strong>sub</strong>. The UserID. The sub is omitted if the token is generated from client credential</p>

</li> </ul> <h2>Bans</h2> <p>The JWT contains user's active bans with its expiry date. List of ban types can be obtained from /bans.</p> <h2>Track Login History</h2> <p>This endpoint will track login history to detect suspicious login activity, please provide "device_id" (alphanumeric) in request header parameter otherwise we will set to "unknown".</p> <p>Align with General Data Protection Regulation in Europe, user login history will be kept within 28 days by default"</p>

type ClientService

type ClientService interface {
	TokenGrant(params *TokenGrantParams, authInfo runtime.ClientAuthInfoWriter) (*TokenGrantOK, *TokenGrantBadRequest, *TokenGrantUnauthorized, error)

	SetTransport(transport runtime.ClientTransport)
}

ClientService is the interface for Client methods

func New

func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService

New creates a new o auth API client.

type TokenGrantBadRequest

type TokenGrantBadRequest struct {
	Payload *iamclientmodels.OauthmodelErrorResponse
}

TokenGrantBadRequest handles this case with default header values.

General request error

func NewTokenGrantBadRequest

func NewTokenGrantBadRequest() *TokenGrantBadRequest

NewTokenGrantBadRequest creates a TokenGrantBadRequest with default headers values

func (*TokenGrantBadRequest) Error

func (o *TokenGrantBadRequest) Error() string

func (*TokenGrantBadRequest) GetPayload

type TokenGrantOK

type TokenGrantOK struct {
	Payload *iamclientmodels.OauthmodelTokenResponse
}

TokenGrantOK handles this case with default header values.

Token returned

func NewTokenGrantOK

func NewTokenGrantOK() *TokenGrantOK

NewTokenGrantOK creates a TokenGrantOK with default headers values

func (*TokenGrantOK) Error

func (o *TokenGrantOK) Error() string

func (*TokenGrantOK) GetPayload

type TokenGrantParams

type TokenGrantParams struct {

	/*DeviceID
	  DeviceID (Used on grant type 'password' to track login history) ex. 90252d14544846d79f367148e3f9a3d9

	*/
	DeviceID *string
	/*Code
	  Code (used with grant type 'authorization_code'

	*/
	Code *string
	/*ExtendExp
	  Extend expiration date of refresh token. Only available for grant type 'password'

	*/
	ExtendExp *bool
	/*GrantType
	  Grant Type

	*/
	GrantType string
	/*Namespace
	  Delegated namespace (used with grant type 'password' to do token grant on other namespace)

	*/
	Namespace *string
	/*Password
	  Password (used with grant type 'password'

	*/
	Password *string
	/*RedirectURI
	  Redirect URI (used with grant type 'authorization_code'

	*/
	RedirectURI *string
	/*RefreshToken
	  Refresh Token (used with grant type 'refresh_token'

	*/
	RefreshToken *string
	/*Username
	  User Name (used with grant type 'password'

	*/
	Username *string

	Context    context.Context
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

TokenGrantParams contains all the parameters to send to the API endpoint for the token grant operation typically these are written to a http.Request

func NewTokenGrantParams

func NewTokenGrantParams() *TokenGrantParams

NewTokenGrantParams creates a new TokenGrantParams object with the default values initialized.

func NewTokenGrantParamsWithContext

func NewTokenGrantParamsWithContext(ctx context.Context) *TokenGrantParams

NewTokenGrantParamsWithContext creates a new TokenGrantParams object with the default values initialized, and the ability to set a context for a request

func NewTokenGrantParamsWithHTTPClient

func NewTokenGrantParamsWithHTTPClient(client *http.Client) *TokenGrantParams

NewTokenGrantParamsWithHTTPClient creates a new TokenGrantParams object with the default values initialized, and the ability to set a custom HTTPClient for a request

func NewTokenGrantParamsWithTimeout

func NewTokenGrantParamsWithTimeout(timeout time.Duration) *TokenGrantParams

NewTokenGrantParamsWithTimeout creates a new TokenGrantParams object with the default values initialized, and the ability to set a timeout on a request

func (*TokenGrantParams) SetCode

func (o *TokenGrantParams) SetCode(code *string)

SetCode adds the code to the token grant params

func (*TokenGrantParams) SetContext

func (o *TokenGrantParams) SetContext(ctx context.Context)

SetContext adds the context to the token grant params

func (*TokenGrantParams) SetDeviceID

func (o *TokenGrantParams) SetDeviceID(deviceID *string)

SetDeviceID adds the deviceId to the token grant params

func (*TokenGrantParams) SetExtendExp

func (o *TokenGrantParams) SetExtendExp(extendExp *bool)

SetExtendExp adds the extendExp to the token grant params

func (*TokenGrantParams) SetGrantType

func (o *TokenGrantParams) SetGrantType(grantType string)

SetGrantType adds the grantType to the token grant params

func (*TokenGrantParams) SetHTTPClient

func (o *TokenGrantParams) SetHTTPClient(client *http.Client)

SetHTTPClient adds the HTTPClient to the token grant params

func (*TokenGrantParams) SetNamespace

func (o *TokenGrantParams) SetNamespace(namespace *string)

SetNamespace adds the namespace to the token grant params

func (*TokenGrantParams) SetPassword

func (o *TokenGrantParams) SetPassword(password *string)

SetPassword adds the password to the token grant params

func (*TokenGrantParams) SetRedirectURI

func (o *TokenGrantParams) SetRedirectURI(redirectURI *string)

SetRedirectURI adds the redirectUri to the token grant params

func (*TokenGrantParams) SetRefreshToken

func (o *TokenGrantParams) SetRefreshToken(refreshToken *string)

SetRefreshToken adds the refreshToken to the token grant params

func (*TokenGrantParams) SetTimeout

func (o *TokenGrantParams) SetTimeout(timeout time.Duration)

SetTimeout adds the timeout to the token grant params

func (*TokenGrantParams) SetUsername

func (o *TokenGrantParams) SetUsername(username *string)

SetUsername adds the username to the token grant params

func (*TokenGrantParams) WithCode

func (o *TokenGrantParams) WithCode(code *string) *TokenGrantParams

WithCode adds the code to the token grant params

func (*TokenGrantParams) WithContext

func (o *TokenGrantParams) WithContext(ctx context.Context) *TokenGrantParams

WithContext adds the context to the token grant params

func (*TokenGrantParams) WithDeviceID

func (o *TokenGrantParams) WithDeviceID(deviceID *string) *TokenGrantParams

WithDeviceID adds the deviceID to the token grant params

func (*TokenGrantParams) WithExtendExp

func (o *TokenGrantParams) WithExtendExp(extendExp *bool) *TokenGrantParams

WithExtendExp adds the extendExp to the token grant params

func (*TokenGrantParams) WithGrantType

func (o *TokenGrantParams) WithGrantType(grantType string) *TokenGrantParams

WithGrantType adds the grantType to the token grant params

func (*TokenGrantParams) WithHTTPClient

func (o *TokenGrantParams) WithHTTPClient(client *http.Client) *TokenGrantParams

WithHTTPClient adds the HTTPClient to the token grant params

func (*TokenGrantParams) WithNamespace

func (o *TokenGrantParams) WithNamespace(namespace *string) *TokenGrantParams

WithNamespace adds the namespace to the token grant params

func (*TokenGrantParams) WithPassword

func (o *TokenGrantParams) WithPassword(password *string) *TokenGrantParams

WithPassword adds the password to the token grant params

func (*TokenGrantParams) WithRedirectURI

func (o *TokenGrantParams) WithRedirectURI(redirectURI *string) *TokenGrantParams

WithRedirectURI adds the redirectURI to the token grant params

func (*TokenGrantParams) WithRefreshToken

func (o *TokenGrantParams) WithRefreshToken(refreshToken *string) *TokenGrantParams

WithRefreshToken adds the refreshToken to the token grant params

func (*TokenGrantParams) WithTimeout

func (o *TokenGrantParams) WithTimeout(timeout time.Duration) *TokenGrantParams

WithTimeout adds the timeout to the token grant params

func (*TokenGrantParams) WithUsername

func (o *TokenGrantParams) WithUsername(username *string) *TokenGrantParams

WithUsername adds the username to the token grant params

func (*TokenGrantParams) WriteToRequest

func (o *TokenGrantParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error

WriteToRequest writes these params to a swagger request

type TokenGrantReader

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

TokenGrantReader is a Reader for the TokenGrant structure.

func (*TokenGrantReader) ReadResponse

func (o *TokenGrantReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error)

ReadResponse reads a server response into the received o.

type TokenGrantUnauthorized

type TokenGrantUnauthorized struct {
	Payload *iamclientmodels.OauthmodelErrorResponse
}

TokenGrantUnauthorized handles this case with default header values.

Client authentication failed

func NewTokenGrantUnauthorized

func NewTokenGrantUnauthorized() *TokenGrantUnauthorized

NewTokenGrantUnauthorized creates a TokenGrantUnauthorized with default headers values

func (*TokenGrantUnauthorized) Error

func (o *TokenGrantUnauthorized) Error() string

func (*TokenGrantUnauthorized) GetPayload

Jump to

Keyboard shortcuts

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