mirror of
https://github.com/hanzoai/o11y.git
synced 2026-10-30 14:56:15 +00:00
o11y carried a second identity system: email/password sign-in, Google,
OIDC and SAML callbacks, self-registration, invites, reset-password
tokens, roles-on-users, SSO auth domains, and a pair of tokenizers that
minted and stored its own sessions. Hanzo IAM answers all of it, once,
at the edge. Two credential stores is one too many, and the one nobody
signs into is the one that rots.
What is left is Identity: WHO a request is, resolved from what the edge
asserted or from a service-account key, never issued here. The routes are
not merely unrouted — the handlers, stores, tables and templates behind
them are gone, and anonymous_test.go names each dead address so that
re-exempting one fails even though no route can come back.
The census moves with it: 366 addresses to 329, 353 typed ops to 319, ten
escape hatches to seven. zipdoc_gen.go loses the 34 descriptions whose
addresses left, because zip keys its doc registry by method and path, so
a description outliving its declaration attaches this module's prose to
whatever a host serves at that address. zipdoc_test.go pins that.
Cherry-picked from delete/o11y-identity 89854a68ae.
51 lines
2.4 KiB
Go
51 lines
2.4 KiB
Go
package o11yapiserver
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/hanzoai/o11y/pkg/http/handler"
|
|
"github.com/hanzoai/o11y/pkg/http/routing"
|
|
"github.com/hanzoai/o11y/pkg/types/authtypes"
|
|
)
|
|
|
|
// ONE user route survives, and it is a READ of the caller's OWN identity.
|
|
//
|
|
// o11y used to answer twenty-five routes here: invites, passwords, reset
|
|
// tokens, member listing, member editing, role assignment. Every one was a
|
|
// SECOND ANSWER to a question Hanzo IAM already answers, and a second answer is
|
|
// a second place to get it wrong — a password store o11y must hash and rotate,
|
|
// an invite link o11y must expire, a member edit that disagrees with the one
|
|
// IAM holds. They are DELETED, with their handlers, their stores and their
|
|
// tables, not disabled: a surface that is only turned off is still a surface
|
|
// someone turns back on.
|
|
//
|
|
// GetMyUser stays because the console cannot render without knowing WHO it is
|
|
// rendering for, and this is the one identity question o11y can answer from
|
|
// what the edge already told it. It reads the CLAIMS, not a row (see
|
|
// impluser.GetMyUser). That is the whole of the difference: o11y REPORTS the
|
|
// identity it was handed; it does not keep one.
|
|
//
|
|
// OpenAccess, unchanged: the gate on this route has always been "is anyone
|
|
// authenticated", never a role, because the answer is about the caller alone.
|
|
//
|
|
// It is also declared as a typed op at the module's mount seam (identity.go in
|
|
// the repo root), which carries it into the composed document, the SDK, the CLI
|
|
// and the agent surface. That is a second DISPATCH, never a second
|
|
// implementation: the op answers by handing the call to this router.
|
|
func (provider *provider) addUserRoutes(router routing.Router) {
|
|
router.Get("/v1/o11y/users/me", handler.New(provider.authzMiddleware.OpenAccess(provider.userHandler.GetMyUser), handler.OpenAPIDef{
|
|
ID: "GetMyUser",
|
|
Tags: []string{"users"},
|
|
Summary: "Get my user",
|
|
Description: "This endpoint returns the identity the edge asserted for the caller",
|
|
Request: nil,
|
|
RequestContentType: "",
|
|
Response: new(authtypes.UserWithRoles),
|
|
ResponseContentType: "application/json",
|
|
SuccessStatusCode: http.StatusOK,
|
|
ErrorStatusCodes: []int{},
|
|
Deprecated: false,
|
|
SecuritySchemes: []handler.OpenAPISecurityScheme{{Name: authtypes.IdentNProviderIAM.StringValue()}},
|
|
}))
|
|
}
|