README
¶
Web UI
go-auth's web UI modules, which any app can include, and the auth server's app, which is built from them.
- It's built on
@mutablelogic/go-server, from GitHub Packages, with Lit and Carbon's web components. - An app is composed of modules. Each owns an item in the menu bar, and the sidebar while it's active: Credentials, Certificates and LDAP.
Modules
| Import | What it has |
|---|---|
@mutablelogic/go-auth/auth |
Signing in: the providers' and session's types, getSession, signIn, signOut and redirectURL, and localPath and signInURL, which keep the path to return to on this server |
@mutablelogic/go-auth/auth/view |
ga-sign-in, which signs in with the providers, a button for each redirect provider and a username and password for each password provider; and ga-session, who's signed in, with Sign out |
@mutablelogic/go-auth/credential |
The credential API's types and client, the form which stores a credential, and CredentialController, which keeps the credentials in a go-server ListController |
@mutablelogic/go-auth/credential/view |
ga-credentials, a Credentials page; credentialModule, which adds it to an app; and its parts, credentialColumns, credentialFormView, passphraseFormView and valueView |
@mutablelogic/go-auth/cert |
The certificate API's types and client, the forms which create and renew certificates, PEM encoding, and CertController and SubjectController, which keep the certificates and subjects in a go-server ListController |
@mutablelogic/go-auth/cert/view |
ga-certificates, a page of certificate authorities or leaf certificates; ga-subjects, a page of subjects; certModule, which adds both pages to an app; and its parts, authorityColumns, certificateColumns, certDetailsView, certFormView and renewFormView |
@mutablelogic/go-auth/ldap |
The LDAP API's types and client, DN, attribute and filter helpers, the entry and password forms, loadEntrySchemas, listAll, listAllUsers and listAllGroups, escapeDN, rdnLabel, and LdapStatusController, UserController, GroupController, ObjectController and SchemaController, with schemaMatches and syntaxName |
@mutablelogic/go-auth/ldap/view |
ga-ldap-users, ga-ldap-groups, ga-ldap-objects and ga-ldap-schema, the Users, Groups, Objects and Schema pages; LdapPage, the pages' base, with the connection's status in their header; ldapModule, which adds the LDAP pages to an app; and its parts, userColumns, groupColumns, entryColumns, classColumns, attributeColumns, entryFormView, passwordFormView, attrsView and secretView |
Including Credentials in another app:
import { credentialModule } from '@mutablelogic/go-auth/credential/view';
credentialModule({ nav, router, client, root: document.querySelector('main')!, notifications, changes });
- The module: adds the Credentials section to the app's
NavController, its page toroot, and its route to theRouter. - The page:
ga-credentialshas its own header, which stores a credential, and, for AWS and Bitwarden, refreshes the list, since their changes made elsewhere aren't published. It has a table of the credentials, and a panel. The panel gets a credential's value with its passphrase, replaces it, rotates it, and deletes it. - Values: only shown with the passphrase they were encrypted with, so only for the file and pg backends.
- Parts: an app with its own table and panel can use
CredentialController,credentialColumnsand the form views instead. - Certificates:
certModuleadds a Certificates section the same way, with three pages, Leaf Certificates, Certificate Authorities and Subjects. A CA's panel creates a certificate it signs, on the Leaf Certificates page. Its panel downloads a certificate, with its chain, and a leaf certificate's private key, as PEM. It also renews a certificate, enables or disables it, and changes its tags. - Versions: the certificate pages list each certificate's latest version, which alone is renewed, or signs certificates. A row expands to its older versions, which open in the panel, where they can be enabled or disabled, retagged, and downloaded.
- Tags column: a certificate's state comes first, in colour: Valid, Expired or Not yet valid, and Disabled. Its tags, with those it inherits, follow in gray.
- Sorting: the certificate tables sort by Name, Signer and Expires, on the server, when their headers are clicked.
- Toolbar: each certificate table has a search, of the certificates' names, and a settings menu, whose Show disabled lists disabled certificates, and their disabled older versions, which are hidden otherwise.
- Create: each table's toolbar ends with its Create button: a certificate, a certificate authority, or a subject. Create a certificate authority is disabled without a root.
- Subjects: the Subjects page lists the subjects, with how many certificates use each. It edits or deletes one which no certificate uses.
- Signing in: when
/config.jsonhas anauthsection, the app reads the session at start. Someone who isn't signed in goes tologin.html, which returns to the app once they are. Who's signed in, with Sign out, is at the bottom of the sidebar. - Sign-in page:
login.htmllists the providers from theauthsection. It returns to itsreturnparameter, which must be a path on this server. The server sends people there to authorize an OAuth client. - Configuration: the auth server's app includes Certificates only when
/config.jsonhas acertsection, which a server built with certificates registers. Itsrootsays whether a root is stored, without which certificate authorities can't be created. - LDAP:
ldapModuleadds an LDAP section, with Users and Groups, when the server has their DNs, Objects and Schema. Each page's header shows Connected or Disconnected, with the host and user, from theldapsection of/config.json, and then the connection's changes. The app includes it only when/config.jsonhas that section. - Users: a table of users, searched by name, full name, mail and surname. A user's panel shows its groups and attributes. It adds the user to a group, or removes it from one, sets its password, or generates one, which is shown once, edits it, and deletes it.
- Groups: a table of groups, with how many members each has, searched by name and description. A group's panel shows its members which are users, and its attributes. It adds a user to it, or removes one, edits it, and deletes it. Its form is made from the classes groups are created with, without their members or group ID, which the server sets.
- Objects: two panes. On the left, a tree of the directory's branches, from its base DN: entries with entries under them, as
hasSubordinatessays, and containers, such as organizational units, with icons. A branch's children are loaded when it's expanded, or selected. On the right, a table of the selected branch's leaves, such as people and groups, which is searched by name, with the branch's Details. An entry opens in a panel, with its attributes, which edits it, renaming it when its name changes, checks a person's password, and deletes it, when it has no children, other than the entries with the next user and group IDs. Create an entry, in the table's toolbar, makes one under the branch: its structural class, the attribute which names it, and then a form from the class and those it inherits from. What's shown is loaded again when entries change. - Schema: two tabs, of the directory's object classes and attribute types, each a table, searched by name, OID and description, which are loaded once, and again when the directory connects. A class's panel has its kind, the classes it inherits from, and the attributes it must, and may, have; an attribute type's has its syntax, by name, inherited from its super type when it has none, how many values it has, its usage, and the classes which use it. The classes and attributes in a panel open when they're clicked.
- Entry forms: a new user's form is made from the classes users are created with (
ldap/class?for=user), and an existing user's from its own classes, with those they inherit from: what they must have is required, what's common is offered, and Add an attribute adds any other they may have. Attributes the server sets, such as the name,uidNumber, and a POSIX group ID which is the user ID, aren't shown. An empty home directory is/home/and the name.
Layout
| Folder | What it has |
|---|---|
src/credential |
The Credentials module, which npm run build builds into dist |
app |
The auth server's app: index.html, the shell, and index.ts, which adds the modules, and login.html and login.ts, the sign-in page, which npm run build-app builds into app/dist |
embed.go |
Embeds app/dist, with the frontend tag |
cmd |
Serves the app, and /config.json, behind the frontend tag |
Developing
| Command | Description |
|---|---|
make frontend |
Installs from package-lock.json, type checks, and builds the modules and the app |
make frontend-test |
Type checks, and runs the tests |
make |
Builds the UI, and then the commands, which embed it |
- Token: installing needs a token which can read GitHub Packages, in
GITHUB_TOKEN, such as$(gh auth token). - Node: 22.18 or later.
Documentation
¶
Overview ¶
Package frontend is go-auth's web UI: its modules, such as Credentials, which the package @mutablelogic/go-auth exports, and the auth server's app, which make builds into app/dist, and which a command built with the "frontend" tag embeds, as EmbedFS. It's tracked, so go mod tidy, which reads every tag's imports, finds it before the UI is built.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cmd serves the web UI, and the server's configuration, which it reads, beside the API, when the server is built with the "frontend" tag, which embeds the UI, once it's built, with npm, into frontend/dist, which make does.
|
Package cmd serves the web UI, and the server's configuration, which it reads, beside the API, when the server is built with the "frontend" tag, which embeds the UI, once it's built, with npm, into frontend/dist, which make does. |
Click to show internal directories.
Click to hide internal directories.