Passport/pkg/server/index.go

67 lines
2.1 KiB
Go
Raw Normal View History

2024-01-06 17:56:32 +00:00
package server
import (
"code.smartsheep.studio/hydrogen/bus/pkg/kit/publisher"
"code.smartsheep.studio/hydrogen/bus/pkg/wire"
)
var Commands = map[string]publisher.CommandManifest{
"passport.accounts.new": {
Name: "Create a new account",
Description: "Create a new account on passport platform.",
Requirements: wire.CommandRequirements{},
Handle: doRegister,
},
"passport.auth.challenges.new": {
Name: "Create a new challenge",
Description: "Create a new challenge to get access session.",
Requirements: wire.CommandRequirements{},
Handle: startChallenge,
},
"passport.auth.challenges.do": {
Name: "Challenge a challenge",
Description: "Getting closer to get access session.",
Requirements: wire.CommandRequirements{},
Handle: doChallenge,
},
"passport.auth.factor.token": {
Name: "Get a factor token",
Description: "Get the factor token to finish the challenge.",
Requirements: wire.CommandRequirements{},
Handle: getFactorToken,
},
"passport.auth.tokens.exchange": {
Name: "Exchange a pair of token",
Description: "Use the grant token to exchange the first token pair.",
Requirements: wire.CommandRequirements{},
Handle: exchangeToken,
},
"passport.auth.tokens.refresh": {
Name: "Refresh a pair token",
Description: "Use the refresh token to refresh the token pair.",
Requirements: wire.CommandRequirements{},
Handle: refreshToken,
},
2024-01-07 07:52:23 +00:00
"passport.auth": {
Name: "Auth with access token.",
Description: "Auth gateway request with access token.",
Requirements: wire.CommandRequirements{},
Providers: []wire.CommandProvider{
{
ID: "passport.auth",
Implementation: "gateway.auth",
Weight: 1000,
},
},
Handle: doAuth,
},
"passport.test": {
Name: "Test secured resource.",
Description: "Test secured resource connectivity.",
Requirements: wire.CommandRequirements{Authorized: true},
Handle: func(c *publisher.RequestCtx) error {
return c.SendResponse("You got me!")
},
},
2024-01-06 17:56:32 +00:00
}