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 Entry ¶
type Entry struct { Name string `json:"name"` Value interface{} `json:"value"` }
Entry represents an Input or Output Entry in a Callback.
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.
func SoftwareStatementHandler ¶ added in v7.2.0
SoftwareStatementHandler creates a callback handler capable of handling Software Statement registration callbacks.
type JWTPoPHandler ¶ added in v7.2.0
type JWTPoPHandler struct { AuthenticateHandler RegisterHandler }
JWTPoPHandler handles the JWT Proof of Possession callbacks received from the Register and Authenticate Thing tree nodes.
func ProofOfPossessionHandler ¶ added in v7.2.0
func ProofOfPossessionHandler(thingID, audience, keyID string, key crypto.Signer) JWTPoPHandler
ProofOfPossessionHandler creates a callback handler capable of handling JWT Proof of Possession registration and authentication callbacks.
func (JWTPoPHandler) Handle ¶ added in v7.2.0
func (h JWTPoPHandler) Handle(cb Callback) (bool, error)
func (JWTPoPHandler) WithCertificate ¶ added in v7.2.0
func (h JWTPoPHandler) WithCertificate(certificates []*x509.Certificate) JWTPoPHandler
WithCertificate adds a certificate chain to the JWTPoPHandler.
func (JWTPoPHandler) WithClaims ¶ added in v7.2.0
func (h JWTPoPHandler) WithClaims(claims func() interface{}) JWTPoPHandler
WithClaims adds additional claims to the JWTPoPHandler.
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{} SoftwareStatement string }
RegisterHandler handles the callback received from the Register Thing tree node.