zauth

package
v0.0.0-...-8161d15 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package zauth interacts with the Zeus zauth service

Index

Constants

This section is empty.

Variables

View Source
var C *client

Functions

func Init

func Init()

Types

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider is the implementation of `goth.Provider` for accessing Zauth

func (*Provider) BeginAuth

func (p *Provider) BeginAuth(state string) (goth.Session, error)

BeginAuth asks Zauth for an authentication endpoint.

func (*Provider) Debug

func (p *Provider) Debug(_ bool)

Debug is a no-op for Zauth

func (*Provider) FetchUser

func (p *Provider) FetchUser(gothSession goth.Session) (goth.User, error)

FetchUser will go to Zauth and access basic information about the user.

func (*Provider) Name

func (p *Provider) Name() string

func (*Provider) RefreshToken

func (p *Provider) RefreshToken(_ string) (*oauth2.Token, error)

RefreshToken get new access token based on the refresh token Not implemented for Zauth

func (*Provider) RefreshTokenAvailable

func (p *Provider) RefreshTokenAvailable() bool

RefreshTokenAvailable returns if refresh tokens are supported This is not the case for Zauth

func (*Provider) SetName

func (p *Provider) SetName(name string)

func (*Provider) UnmarshalSession

func (p *Provider) UnmarshalSession(data string) (goth.Session, error)

UnmarshalSession a string into a session

type Session

type Session struct {
	AuthURL      string
	AccessToken  string
	RefreshToken string
	ExpiresAt    time.Time
}

Session is the implementation of `goth.Session` for storing data during the auth process with Zauth

func (*Session) Authorize

func (s *Session) Authorize(gothProvider goth.Provider, params goth.Params) (string, error)

Authorize the session with Zauth and return the access token to be stored for future use

func (*Session) GetAuthURL

func (s *Session) GetAuthURL() (string, error)

GetAuthURL will return the URL set by calling the `BeginAuth` function on the Zauth provider.

func (*Session) Marshal

func (s *Session) Marshal() string

Marshal the session into a string

type User

type User struct {
	ID       int      `json:"id"`
	Username string   `json:"username"`
	Admin    bool     `json:"admin"`
	FullName string   `json:"full_name"`
	Roles    []string `json:"roles"`
}

User contains the user data received from Zauth

Jump to

Keyboard shortcuts

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