Documentation ¶
Overview ¶
Package callback provides types for handling authentication callbacks. Use the predefined callback handlers to process callbacks received from Access Management's authentication framework or use the Handler interface to provide your own handler.
This is an example of how to create your own callback handler:
type ThingHandler struct { ThingInput string } func (h ThingHandler) Handle(cb callback.Callback) (bool, error) { if cb.Type != "ThingCallback" { return false, nil } cb.Input[0].Value = h.ThingInput return true, nil }
The handler can then be used during the authentication process of a thing or session:
builder.Thing().HandleCallbacksWith(ThingHandler{ThingInput: "value"})
Index ¶
Constants ¶
const ( // Authentication callback names TypeNameCallback = "NameCallback" TypePasswordCallback = "PasswordCallback" TypeTextInputCallback = "TextInputCallback" TypeHiddenValueCallback = "HiddenValueCallback" // Thing types used with registration callback TypeDevice ThingType = "device" TypeService ThingType = "service" TypeGateway ThingType = "gateway" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthenticateHandler ¶
type AuthenticateHandler struct { Audience string ThingID string KeyID string Key crypto.Signer Claims func() interface{} }
AuthenticateHandler handles the callback received from the Authenticate Thing tree node.
type Callback ¶
type Callback struct { Type string `json:"type,omitempty"` Output []Entry `json:"output,omitempty"` Input []Entry `json:"input,omitempty"` }
Callback describes an AM callback request and response structure.
type Handler ¶
type Handler interface { // Handle the callback by modifying it. Return true if the callback was handled. Handle(cb Callback) (bool, error) }
Handler is an interface for an AM callback handler.
type NameHandler ¶
type NameHandler struct { // Name\Username\ID for the identity Name string }
NameHandler handles an AM Username Collector callback.
type PasswordHandler ¶
type PasswordHandler struct { // Password for the identity Password string }
PasswordHandler handles an AM Password Collector callback.
type RegisterHandler ¶
type RegisterHandler struct { Audience string ThingID string ThingType ThingType KeyID string Key crypto.Signer Certificates []*x509.Certificate Claims func() interface{} }
RegisterHandler handles the callback received from the Register Thing tree node.