auth

package
v0.0.0-...-9914b64 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler handles MiAuth endpoints.

func NewHandler

func NewHandler(repo repository.AuthSessionRepository, cfg *config.Config, idGen id.Generator, entityPacker *entity.Packer, detailExtras userpack.DetailExtras, background *bgwork.Group) *Handler

NewHandler creates a new auth handler. entityPacker is the Packer this handler packs entities with (#3792); detailExtras fills pinnedNotes / pinnedPage / movedTo / alsoKnownAs for auth/session/userkey and the miauth check (#3330); background is the group the work after a response runs in, so stopping the server generation waits for it (#3661).

func (*Handler) Accept

func (h *Handler) Accept(c *echo.Context) error

Accept handles POST /api/auth/accept.

func (*Handler) GenToken

func (h *Handler) GenToken(c *echo.Context) error

GenToken handles POST /api/miauth/gen-token. MiAuth用のアクセストークンを直接生成する(App不要)。

func (*Handler) MiAuthCheck

func (h *Handler) MiAuthCheck(c *echo.Context) error

MiAuthCheck handles POST /api/miauth/:session/check.

3rd-party クライアントは MiAuth 承認 (= GenToken で session 紐付き access token 作成) 後、本 endpoint を polling して token を取得する。upstream ApiServerService の /miauth/:session/check 相当: session に対応する未取得の token があれば fetched=true にして {ok, token, user} を返し、無ければ {ok:false} を返す。認証不要 (token をまだ持たない client が叩くため)。

func (*Handler) SessionGenerate

func (h *Handler) SessionGenerate(c *echo.Context) error

SessionGenerate handles POST /api/auth/session/generate.

func (*Handler) SessionShow

func (h *Handler) SessionShow(c *echo.Context) error

SessionShow handles POST /api/auth/session/show.

func (*Handler) SessionUserkey

func (h *Handler) SessionUserkey(c *echo.Context) error

SessionUserkey handles POST /api/auth/session/userkey.

func (*Handler) SetTokenNotifier

func (h *Handler) SetTokenNotifier(n TokenNotifier)

SetTokenNotifier attaches a TokenNotifier so gen-token creates a 'createToken' notification (upstream miauth/gen-token)。

func (*Handler) SetUserRepo

func (h *Handler) SetUserRepo(r repository.UserRepository)

SetUserRepo wires the user repository used by MiAuthCheck to pack the approving user.

type TokenNotifier

type TokenNotifier interface {
	OnCreateToken(userID string)
}

TokenNotifier records a 'createToken' notification when a token is generated (#1559)。循環依存を避けるため interface で受け取る (実装は core/notification.Hook)。

Jump to

Keyboard shortcuts

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