accountmigration

package
v0.0.0-...-f83813f Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HookResponseSchema = validation.NewSimpleSchema(`
{
	"type": "object",
	"additionalProperties": false,
	"properties": {
		"identities": {
			"type": "array",
			"minItems": 1,
			"items": {
				"type": "object",
				"additionalProperties": false,
				"properties": {
					"type" : {
						"type": "string",
						"enum" : ["login_id"]
					},
					"login_id": {
						"type": "object",
						"properties": {
							"key": { "type": "string" },
							"type": { "type": "string" },
							"value": { "type": "string" }
						},
						"required": ["key", "type", "value"]
					}
				},
				"required": ["type", "login_id"]
			}
		},
		"authenticators": {
			"type": "array",
			"items": {
				"type": "object",
				"additionalProperties": false,
				"properties": {
					"type" : {
						"type": "string",
						"enum" : ["oob_otp_email", "oob_otp_sms"]
					},
					"oobotp": {
						"email": { "type": "string" },
						"phone": { "type": "string" }
					}
				},
				"allOf": [
					{
						"if": { "properties": { "type": { "const": "oob_otp_email" } } },
						"then": {
							"properties": {
								"oobotp": {
									"required": ["email"]
								}
							},
							"required": ["oobotp"]
						}
					},
					{
						"if": { "properties": { "type": { "const": "oob_otp_sms" } } },
						"then": {
							"properties": {
								"oobotp": {
									"required": ["phone"]
								}
							},
							"required": ["oobotp"]
						}
					}
				]
			}
		}
	},
	"required": ["identities"]
}
`)
View Source
var InvalidConfiguration = apierrors.InternalError.WithReason("InvalidConfiguration")

Functions

This section is empty.

Types

type AccountMigrationDenoHook

type AccountMigrationDenoHook struct {
	hook.DenoHook
	Client HookDenoClient
	Logger DenoMiddlewareLogger
}

func (*AccountMigrationDenoHook) Call

type AccountMigrationWebHook

type AccountMigrationWebHook struct {
	hook.WebHook
	Client HookHTTPClient
	Logger WebhookMiddlewareLogger
}

func (*AccountMigrationWebHook) Call

type DenoMiddlewareLogger

type DenoMiddlewareLogger struct{ *log.Logger }

func NewDenoMiddlewareLogger

func NewDenoMiddlewareLogger(lf *log.Factory) DenoMiddlewareLogger

type Hook

type Hook interface {
	Call(ctx context.Context, u *url.URL, hookReq *HookRequest) (*HookResponse, error)
}

type HookDenoClient

type HookDenoClient struct {
	hook.DenoClient
}

func NewHookDenoClient

func NewHookDenoClient(endpoint config.DenoEndpoint, logger hook.Logger, cfg *config.AccountMigrationHookConfig) HookDenoClient

type HookHTTPClient

type HookHTTPClient struct {
	*http.Client
}

type HookRequest

type HookRequest struct {
	MigrationToken string `json:"migration_token"`
}

type HookResponse

type HookResponse struct {
	Identities     []*identity.MigrateSpec
	Authenticators []*authenticator.MigrateSpec
}

func ParseHookResponse

func ParseHookResponse(r io.Reader) (*HookResponse, error)

type Service

type Service struct {
	Config   *config.AccountMigrationHookConfig
	DenoHook *AccountMigrationDenoHook
	WebHook  *AccountMigrationWebHook
}

func (*Service) Run

func (s *Service) Run(ctx context.Context, migrationTokenString string) (*HookResponse, error)

type WebhookMiddlewareLogger

type WebhookMiddlewareLogger struct{ *log.Logger }

func NewWebhookMiddlewareLogger

func NewWebhookMiddlewareLogger(lf *log.Factory) WebhookMiddlewareLogger

Jump to

Keyboard shortcuts

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