Documentation
¶
Overview ¶
Package postgres is the identity_subjects table: the subject each address most recently authenticated as, and whether the person themselves recorded it.
It is the PostgreSQL half of internal/platform/subjects, split out under the module's postgres/ convention (pkg/audit/postgres, pkg/oauth/postgres) once the SQL grew past the point where it read as part of the Book that uses it. It knows nothing about that Book: it stores pairs and answers them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements subjects.Store over the identity_subjects table.
func New ¶
New builds the store. A nil db yields a store that records nothing and knows nothing, so a caller need not check.
func (*Store) LookupPerson ¶
LookupPerson reads only a pair the person themselves recorded.
func (*Store) Record ¶
Record upserts the pair, keeping the subject most recently seen.
A key's pair never overwrites a person's. Without that rule a service key configured with somebody's address would replace their subject with its own, and the key issued against their account would then authenticate as the service key instead of as them (#1759). A person's own sign-in always wins, which is also how a row a key wrote earlier is repaired.