v2.3.0 fc65046

auth.go RawHistoryFolder

1package in
2
3import (
4	"context"
5	"time"
6
7	"gordon/internal/domain"
8)
9
10// AuthService defines the contract for registry authentication operations.
11type AuthService interface {
12	// GetAuthType returns the configured authentication type.
13	GetAuthType() domain.AuthType
14
15	// IsEnabled returns whether authentication is enabled.
16	IsEnabled() bool
17
18	// Password authentication
19	// ValidatePassword checks if the username and password are valid.
20	ValidatePassword(ctx context.Context, username, password string) bool
21
22	// Token authentication
23	// ValidateToken validates a JWT token and returns its claims.
24	ValidateToken(ctx context.Context, tokenString string) (*domain.TokenClaims, error)
25
26	// GenerateToken creates a new JWT token for the given subject and stores it.
27	// If expiry is 0, the token never expires.
28	GenerateToken(ctx context.Context, subject string, scopes []string, expiry time.Duration) (string, error)
29
30	// GenerateAccessToken creates a short-lived JWT for registry access without storing it.
31	// Used by /v2/token endpoint for Docker client sessions.
32	GenerateAccessToken(ctx context.Context, subject string, scopes []string, expiry time.Duration) (string, error)
33
34	// RevokeToken revokes a token by its ID.
35	RevokeToken(ctx context.Context, tokenID string) error
36
37	// ListTokens returns all stored tokens.
38	ListTokens(ctx context.Context) ([]domain.Token, error)
39
40	// GeneratePasswordHash generates a bcrypt hash for a password.
41	GeneratePasswordHash(password string) (string, error)
42}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close