auth

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const OIDC_TIMEOUT = 10 * time.Second

Variables

This section is empty.

Functions

func GetIDPSyncStatus

func GetIDPSyncStatus() models.IDPSyncStatus

func GetMatchingUser

func GetMatchingUser(oauthUser *OAuthUser) (*schema.User, error)

func HandleAuthCallback

func HandleAuthCallback(w http.ResponseWriter, r *http.Request)

HandleAuthCallback - handles oauth callback Note: not included in API reference as part of the OAuth process itself.

func HandleAuthLogin

func HandleAuthLogin(w http.ResponseWriter, r *http.Request)

swagger:route GET /api/oauth/login nodes HandleAuthLogin

Handles OAuth login.

		Schemes: https

		Security:
  		oauth
		Responses:
		200:  okResponse

func HandleHeadlessSSO

func HandleHeadlessSSO(w http.ResponseWriter, r *http.Request)

HandleHeadlessSSO - handles the OAuth login flow for headless interfaces such as Netmaker CLI via websocket

func HandleHeadlessSSOCallback

func HandleHeadlessSSOCallback(w http.ResponseWriter, r *http.Request)

HandleHeadlessSSOCallback - handle OAuth callback for headless logins such as Netmaker CLI

func HandleHostSSOCallback

func HandleHostSSOCallback(w http.ResponseWriter, r *http.Request)

HandleHostSSOCallback handles the callback from the sso endpoint It is the analogue of auth.handleNodeSSOCallback but takes care of the end point flow Retrieves the mkey from the state cache and adds the machine to the users email namespace TODO: A confirmation page for new machines should be added to avoid phishing vulnerabilities TODO: Add groups information from OIDC tokens into machine HostInfo Listens in /oidc/callback.

func InitializeAuthProvider

func InitializeAuthProvider() string

InitializeAuthProvider - initializes the auth provider if any is present

func IsOAuthConfigured

func IsOAuthConfigured() bool

func RegisterHostSSO

func RegisterHostSSO(w http.ResponseWriter, r *http.Request)

RegisterHostSSO redirects to the IDP for authentication Puts machine key in cache so the callback can retrieve it using the oidc state param Listens in /oidc/register/:regKey.

func ResetAuthProvider

func ResetAuthProvider()

ResetAuthProvider resets the auth provider configuration.

func ResetIDPSyncHook

func ResetIDPSyncHook()

func SyncFromIDP

func SyncFromIDP() error

Types

type OAuthUser

type OAuthUser struct {
	ID                StringOrInt `json:"id" bson:"id"`
	Name              string      `json:"name" bson:"name"`
	Email             string      `json:"email" bson:"email"`
	Login             string      `json:"login" bson:"login"`
	UserPrincipalName string      `json:"userPrincipalName" bson:"userPrincipalName"`
	AccessToken       string      `json:"accesstoken" bson:"accesstoken"`
}

OAuthUser - generic OAuth strategy user

type StringOrInt

type StringOrInt string

func (*StringOrInt) UnmarshalJSON

func (s *StringOrInt) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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