auth

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2022 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Name represents name of the service
	Name = "authorization-service"
	// AuthorizationRequestMessageType defines auth request type of the communication protocol
	AuthorizationRequestMessageType types.ProtocolMessage = protocol.ProtocolName + "/authorization-request/v1"
	// AuthorizationResponseMessageType defines auth response type of the communication protocol
	AuthorizationResponseMessageType types.ProtocolMessage = protocol.ProtocolName + "/authorization-response/v1"
)

Variables

This section is empty.

Functions

func CreateAuthorizationRequest

func CreateAuthorizationRequest(aud, callbackURL string) *types.AuthorizationMessageRequest

CreateAuthorizationRequest creates new authorization request message

func Verify

func Verify(message types.Message) (err error)

Verify only proofs of a verification of authorization response message

Types

type UserToken

type UserToken struct {
	ID        string                            `json:"id"`
	Challenge string                            `json:"challenge"`
	State     string                            `json:"state"`
	Scope     map[string]map[string]interface{} `json:"scope"`
}

UserToken is token that can be used for user authorization

func ExtractMetadata

func ExtractMetadata(message types.Message) (token *UserToken, err error)

ExtractMetadata extract userToken from provided proofs

func (*UserToken) Update added in v0.0.5

func (token *UserToken) Update(scopeID string, metadata types.ProofMetadata) error

Update adds new metadata to user token

func (*UserToken) VerifyState

func (token *UserToken) VerifyState(ctx context.Context, url, addr string) (verification.StateVerificationResult, error)

VerifyState verifies state that is stored in the token

Jump to

Keyboard shortcuts

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