m2m

package
v15.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrJWTTooOld = errors.New("JWT too old")

Functions

This section is empty.

Types

type AuthenticateTokenParams

type AuthenticateTokenParams struct {
	AccessToken    string
	RequiredScopes []string
	MaxTokenAge    time.Duration
	// AuthorizationFunc is a custom function to authorize the client's scopes. If omitted, the default function will be used.
	// The default function assumes scopes are either direct string matches or written in the form "action:resource".
	// See the documentation for `shared.PerformAuthorizationCheck` for more information.
	AuthorizationFunc *ScopeAuthorizationFunc
}

type AuthenticateTokenResponse

type AuthenticateTokenResponse struct {
	// Scopes is an array of scopes granted to the token holder.
	Scopes []string
	// ClientID is the ID of the client that was issued the token
	ClientID string
	// CustomClaims is a map of custom claims present in the token
	CustomClaims map[string]any
}

type M2MClient

type M2MClient struct {
	// ClientID: The ID of the client.
	ClientID string `json:"client_id,omitempty"`
	// ClientName: A human-readable name for the client.
	ClientName string `json:"client_name,omitempty"`
	// ClientDescription: A human-readable description for the client.
	ClientDescription string `json:"client_description,omitempty"`
	// Status: The status of the client - either `active` or `inactive`.
	Status string `json:"status,omitempty"`
	// Scopes: An array of scopes assigned to the client.
	Scopes []string `json:"scopes,omitempty"`
	// ClientSecretLastFour: The last four characters of the client secret.
	ClientSecretLastFour string `json:"client_secret_last_four,omitempty"`
	// TrustedMetadata: An arbitrary JSON object for storing application-specific data.
	TrustedMetadata map[string]any `json:"trusted_metadata,omitempty"`
	// NextClientSecretLastFour: The last four characters of the `next_client_secret`. Null if no
	// `next_client_secret` exists.
	NextClientSecretLastFour string `json:"next_client_secret_last_four,omitempty"`
}

M2MClient:

type M2MClientWithClientSecret

type M2MClientWithClientSecret struct {
	// ClientID: The ID of the client.
	ClientID string `json:"client_id,omitempty"`
	// ClientSecret: The secret of the client. **Important:** this is the only time you will be able to view
	// the `client_secret`. Be sure to persist the `client_secret` in a secure location. If the `client_secret`
	// is lost, you will need to trigger a secret rotation flow to receive another one.
	ClientSecret string `json:"client_secret,omitempty"`
	// ClientName: A human-readable name for the client.
	ClientName string `json:"client_name,omitempty"`
	// ClientDescription: A human-readable description for the client.
	ClientDescription string `json:"client_description,omitempty"`
	// Status: The status of the client - either `active` or `inactive`.
	Status string `json:"status,omitempty"`
	// Scopes: An array of scopes assigned to the client.
	Scopes []string `json:"scopes,omitempty"`
	// ClientSecretLastFour: The last four characters of the client secret.
	ClientSecretLastFour string `json:"client_secret_last_four,omitempty"`
	// TrustedMetadata: An arbitrary JSON object for storing application-specific data.
	TrustedMetadata map[string]any `json:"trusted_metadata,omitempty"`
	// NextClientSecretLastFour: The last four characters of the `next_client_secret`. Null if no
	// `next_client_secret` exists.
	NextClientSecretLastFour string `json:"next_client_secret_last_four,omitempty"`
}

M2MClientWithClientSecret:

type M2MClientWithNextClientSecret

type M2MClientWithNextClientSecret struct {
	// ClientID: The ID of the client.
	ClientID string `json:"client_id,omitempty"`
	// NextClientSecret: The newly created secret that's next in rotation for the client. **Important:** this
	// is the only time you will be able to view the `next_client_secret`. Be sure to persist the
	// `next_client_secret` in a secure location. If the `next_client_secret` is lost, you will need to trigger
	// a secret rotation flow to receive another one.
	NextClientSecret string `json:"next_client_secret,omitempty"`
	// ClientName: A human-readable name for the client.
	ClientName string `json:"client_name,omitempty"`
	// ClientDescription: A human-readable description for the client.
	ClientDescription string `json:"client_description,omitempty"`
	// Status: The status of the client - either `active` or `inactive`.
	Status string `json:"status,omitempty"`
	// Scopes: An array of scopes assigned to the client.
	Scopes []string `json:"scopes,omitempty"`
	// ClientSecretLastFour: The last four characters of the client secret.
	ClientSecretLastFour string `json:"client_secret_last_four,omitempty"`
	// TrustedMetadata: An arbitrary JSON object for storing application-specific data.
	TrustedMetadata map[string]any `json:"trusted_metadata,omitempty"`
	// NextClientSecretLastFour: The last four characters of the `next_client_secret`. Null if no
	// `next_client_secret` exists.
	NextClientSecretLastFour string `json:"next_client_secret_last_four,omitempty"`
}

M2MClientWithNextClientSecret:

type M2MSearchQuery

type M2MSearchQuery struct {
	// Operator: The action to perform on the operands. The accepted value are:
	//
	//   `AND` – all the operand values provided must match.
	//
	//   `OR` – the operator will return any matches to at least one of the operand values you supply.
	Operator M2MSearchQueryOperator `json:"operator,omitempty"`
	// Operands: An array of operand objects that contains all of the filters and values to apply to your
	// search search query.
	Operands []map[string]any `json:"operands,omitempty"`
}

M2MSearchQuery:

type M2MSearchQueryOperator

type M2MSearchQueryOperator string
const (
	M2MSearchQueryOperatorOR  M2MSearchQueryOperator = "OR"
	M2MSearchQueryOperatorAND M2MSearchQueryOperator = "AND"
)

type ResultsMetadata

type ResultsMetadata struct {
	// Total: The total number of results returned by your search query.
	Total int32 `json:"total,omitempty"`
	// NextCursor: The `next_cursor` string is returned when your search result contains more than one page of
	// results. This value is passed into your next search call in the `cursor` field.
	NextCursor string `json:"next_cursor,omitempty"`
}

ResultsMetadata:

type ScopeAuthorizationFunc

type ScopeAuthorizationFunc func(ScopeAuthorizationFuncParams) error

type ScopeAuthorizationFuncParams

type ScopeAuthorizationFuncParams struct {
	HasScopes      []string
	RequiredScopes []string
}

type TokenParams

type TokenParams struct {
	// ClientID is the ID of the client.
	ClientID string
	// ClientSecret is the secret of the client.
	ClientSecret string
	// Scopes is an array scopes requested. If omitted, all scopes assigned to the client will be returned.
	Scopes []string
}

type TokenResponse

type TokenResponse struct {
	// The access token granted to the client. Access tokens are JWTs signed with the project's JWKs.
	AccessToken string `json:"access_token"`
	// The lifetime in seconds of the access token.
	// For example, the value 3600 denotes that the access token will expire in one hour from the time the response was generated.
	ExpiresIn int `json:"expires_in"`
	// The type of the returned access token. Today, this value will always be equal to "bearer"
	TokenType string `json:"token_type"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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