auth

package
v0.0.0-...-96aafe2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GCIPAuthenticator

type GCIPAuthenticator struct {
	UserAuthClient
}

GCIPAuthenticator is a struct that authenticates users using Firebase Auth, which is part of Google Cloud Identity Platform (GCIP). It implements the UserAuthClient interface.

func NewGCIPAuthenticator

func NewGCIPAuthenticator(client UserAuthClient) *GCIPAuthenticator

NewGCIPAuthenticator creates a new GCIPAuthenticator instance.

func (GCIPAuthenticator) Authenticate

func (a GCIPAuthenticator) Authenticate(ctx context.Context, idToken string) (*User, error)

Authenticate authenticates a user using the provided ID token.

type GCPTokenGenerator

type GCPTokenGenerator struct{}

GCPTokenGenerator generates an authentication token for processes running inside GCP.

type User

type User struct {
	ID string
	// GitHubUserID is the string representation of the GitHub user's integer ID,
	// as returned by Firebase Auth.
	//
	// It is a pointer because it may be nil if the user is authenticated but not
	// linked to GitHub, or if the ID hasn't been verified against the GitHub API yet.
	// Verification is deferred until needed to keep most authenticated calls fast.
	GitHubUserID *string
}

User contains the details of an authenticated user.

func (User) HasGitHubUserID

func (u User) HasGitHubUserID(in int64) bool

HasGitHubID checks if the authenticated user matches a specific GitHub integer ID. It handles the necessary string-to-int64 conversion safely.

type UserAuthClient

type UserAuthClient interface {
	VerifyIDToken(context.Context, string) (*firebaseauth.Token, error)
}

UserAuthClient is an interface that defines the methods for interacting with a user authentication provider.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL