client

package
v7.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const AppJOSE coap.MediaType = 11650

CoAP Content-Formats registry does not contain a JOSE value, using an unassigned value

Variables

View Source
var ErrUnauthorised = errors.New("unauthorised")

Functions

func SetAuthenticationTree

func SetAuthenticationTree(connection Connection, tree string)

SetAuthenticationTree changes the authentication tree that the connection was created with. This is a convenience function for functional testing.

Types

type AMInfoResponse

type AMInfoResponse struct {
	Realm          string
	AccessTokenURL string
	AttributesURL  string
	ThingsVersion  string
}

AMInfoResponse contains the information required to construct valid signed JWTs

type AuthenticatePayload

type AuthenticatePayload struct {
	SessionToken
	AuthId    string              `json:"authId,omitempty"`
	AuthIDKey string              `json:"auth_id_digest,omitempty"`
	Callbacks []callback.Callback `json:"callbacks,omitempty"`
}

AuthenticatePayload represents the outbound and inbound data during an authentication request

func (AuthenticatePayload) HasSessionToken

func (p AuthenticatePayload) HasSessionToken() bool

HasSessionToken returns true if the payload contains a session token Indicates that the authentication workflow has completed successfully

func (AuthenticatePayload) String

func (p AuthenticatePayload) String() string

type Connection

type Connection interface {
	// initialise the client. Must be called before the Client is used by a Thing
	Initialise() error

	// authenticate sends an authenticate request to the ForgeRock platform
	Authenticate(payload AuthenticatePayload) (reply AuthenticatePayload, err error)

	// amInfo returns the information required to construct valid signed JWTs
	AMInfo() (info AMInfoResponse, err error)

	// validateSession sends a validate session request
	ValidateSession(tokenID string) (ok bool, err error)

	// logoutSession makes a request to logout the session
	LogoutSession(tokenID string) (err error)

	// accessToken makes an access token request with the given session token and payload
	AccessToken(tokenID string, content ContentType, payload string) (reply []byte, err error)

	// IntrospectAccessToken makes a request to introspect an access token
	IntrospectAccessToken(token string) (introspection []byte, err error)

	// attributes makes a thing attributes request with the given session token and payload
	Attributes(tokenID string, content ContentType, payload string, names []string) (reply []byte, err error)
}

connection to the ForgeRock platform

type ConnectionBuilder

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

func NewConnection

func NewConnection() *ConnectionBuilder

func (*ConnectionBuilder) ConnectTo

func (b *ConnectionBuilder) ConnectTo(url *url.URL) *ConnectionBuilder

func (*ConnectionBuilder) Create

func (b *ConnectionBuilder) Create() (Connection, error)

func (*ConnectionBuilder) InRealm

func (b *ConnectionBuilder) InRealm(realm string) *ConnectionBuilder

func (*ConnectionBuilder) TimeoutRequestAfter

func (b *ConnectionBuilder) TimeoutRequestAfter(timeout time.Duration) *ConnectionBuilder

func (*ConnectionBuilder) WithKey

func (*ConnectionBuilder) WithTree

func (b *ConnectionBuilder) WithTree(tree string) *ConnectionBuilder

type ContentType

type ContentType string
const (
	ApplicationJSON ContentType = "application/json"
	ApplicationJOSE ContentType = "application/jose"
)

type GetAccessTokenPayload

type GetAccessTokenPayload struct {
	Scope []string `json:"scope,omitempty"`
}

func (GetAccessTokenPayload) String

func (p GetAccessTokenPayload) String() string

type IntrospectPayload

type IntrospectPayload struct {
	Token         string `json:"token"`
	TokenTypeHint string `json:"token_type_hint,omitempty"`
}

IntrospectPayload contains an introspection request as defined by rfc7662

type SessionToken

type SessionToken struct {
	TokenID string `json:"tokenId,omitempty"`
}

SessionToken holds a session token

type ThingEndpointPayload

type ThingEndpointPayload struct {
	Token   string `json:"token"`
	Payload string `json:"payload,omitempty"`
}

ThingEndpointPayload wraps the payload destined for the Thing endpoint with the session token

Jump to

Keyboard shortcuts

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