Phase 12: signing in with the Core's Authelia
Admins make the client's secret under Settings → Sign-in, which shows the entry for the Core's idproviders.yml (the secret's PBKDF2-SHA512 hash, the redirect address, PKCE). People sign in with their Core account: invited ones are matched by verified email, then by subject; optionally anyone at the Core's domain joins. Passwords can be turned off but for the owner's, and signing out ends the Core's session where it can. On multi-tenant, the team is found by its proved domain. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,7 @@ import (
|
||||
"supermarket/internal/db"
|
||||
"supermarket/internal/legacy"
|
||||
"supermarket/internal/metrics"
|
||||
"supermarket/internal/oidc"
|
||||
"supermarket/internal/posting"
|
||||
"supermarket/internal/prospects"
|
||||
"supermarket/internal/secrets"
|
||||
@@ -113,6 +114,9 @@ type teamCache struct {
|
||||
// Google's access token, which lasts an hour.
|
||||
googleToken string
|
||||
googleExpires time.Time
|
||||
// The Core's Authelia: its discovery document, kept a while.
|
||||
provider *oidc.Provider
|
||||
providerAt time.Time
|
||||
}
|
||||
|
||||
// st is the shared state, made on first use.
|
||||
@@ -346,6 +350,10 @@ func (s *Server) Handler() (http.Handler, error) {
|
||||
mux.HandleFunc("POST /teams/switch", (*Server).teamSwitch)
|
||||
mux.HandleFunc("GET /teams/new", (*Server).teamNewPage)
|
||||
mux.HandleFunc("POST /teams/new", (*Server).teamNew)
|
||||
mux.HandleFunc("POST /signin/core", (*Server).signinCore)
|
||||
mux.HandleFunc("GET /auth/core/callback", (*Server).coreCallbackPage)
|
||||
mux.HandleFunc("GET /settings/signin", (*Server).signinSettingsPage)
|
||||
mux.HandleFunc("POST /settings/signin/{action}", (*Server).signinSettingsAction)
|
||||
mux.HandleFunc("GET /signin", (*Server).signinPage)
|
||||
mux.HandleFunc("POST /signin", (*Server).signin)
|
||||
mux.HandleFunc("POST /signin/code", (*Server).signinCode)
|
||||
@@ -935,6 +943,7 @@ var flashes = map[string]string{
|
||||
"team-restored": "Restored.",
|
||||
"exported": "Exported: %d rows. Download it below.",
|
||||
"undeleted": "The team won't be deleted: it's back as it was.",
|
||||
"secret-made": "The client's secret is made: add the entry below to the Core, then Test.",
|
||||
"domain-released": "Released: another team can prove the domain now.",
|
||||
"invitations-resent": "Sent %d invitations again.",
|
||||
"view-needs-reason": "Give a reason and how long: it's recorded in the team's own log.",
|
||||
|
||||
Reference in New Issue
Block a user