auth

package
v0.0.0-...-7dfa3a9 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 8 Imported by: 3 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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