Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Claims ¶
type Claims struct { ID uuid.UUID `json:"id"` Email string `json:"email,omitempty"` Expiration time.Time `json:"expires,omitempty"` }
Claims represents data signed by server and used for authentication.
type Config ¶ added in v1.56.1
type Config struct {
TokenExpirationTime time.Duration `help:"expiration time for account recovery and activation tokens" default:"30m"`
}
Config contains configuration parameters for console auth.
type Service ¶ added in v1.56.1
type Service struct { Signer // contains filtered or unexported fields }
Service handles creating, signing, and checking the expiration of auth tokens.
func NewService ¶ added in v1.56.1
NewService creates a new consoleauth service.
func (*Service) CreateToken ¶ added in v1.56.1
func (s *Service) CreateToken(ctx context.Context, id uuid.UUID, email string) (_ string, err error)
CreateToken creates a new auth token.
type Token ¶
Token represents authentication data structure.
func FromBase64URLString ¶
FromBase64URLString creates Token instance from base64URLEncoded string representation.
type WebappSession ¶ added in v1.56.1
type WebappSession struct { ID uuid.UUID UserID uuid.UUID Address string UserAgent string Status int ExpiresAt time.Time }
WebappSession represents a session on the satellite web app.
type WebappSessions ¶ added in v1.56.1
type WebappSessions interface { // Create creates a webapp session and returns the session info. Create(ctx context.Context, id, userID uuid.UUID, ip, userAgent string, expires time.Time) (WebappSession, error) // GetBySessionID gets the session info from the session ID. GetBySessionID(ctx context.Context, sessionID uuid.UUID) (WebappSession, error) // GetAllByUserID gets all webapp sessions with userID. GetAllByUserID(ctx context.Context, userID uuid.UUID) ([]WebappSession, error) // DeleteBySessionID deletes a webapp session by ID. DeleteBySessionID(ctx context.Context, sessionID uuid.UUID) error // DeleteAllByUserID deletes all webapp sessions by user ID. DeleteAllByUserID(ctx context.Context, userID uuid.UUID) (int64, error) // DeleteAllByUserIDExcept deletes all webapp sessions by user ID except one of sessionID. DeleteAllByUserIDExcept(ctx context.Context, userID uuid.UUID, sessionID uuid.UUID) (int64, error) // UpdateExpiration updates the expiration time of the session. UpdateExpiration(ctx context.Context, sessionID uuid.UUID, expiresAt time.Time) error // DeleteExpired deletes all sessions that have expired before the provided timestamp. DeleteExpired(ctx context.Context, now time.Time, asOfSystemTimeInterval time.Duration, pageSize int) error }
WebappSessions is the repository for webapp sessions.
Click to show internal directories.
Click to hide internal directories.