auth

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const OIDC_TIMEOUT = 10 * time.Second

Variables

This section is empty.

Functions

func CheckNetRegAndHostUpdate

func CheckNetRegAndHostUpdate(networks []string, h *models.Host, relayNodeId uuid.UUID)

CheckNetRegAndHostUpdate - run through networks and send a host update

func FetchPassValue added in v0.24.0

func FetchPassValue(newValue string) (string, 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 IsOauthUser

func IsOauthUser(user *models.User) error

IsOauthUser - returns

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 SessionHandler

func SessionHandler(conn *websocket.Conn)

SessionHandler - called by the HTTP router when user is calling netclient with join/register -s parameter in order to authenticate via SSO mechanism by OAuth2 protocol flow. This triggers a session start and it is managed by the flow implemented here and callback When this method finishes - the auth flow has finished either OK or by timeout or any other error occured

Types

type OAuthUser

type OAuthUser struct {
	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

Jump to

Keyboard shortcuts

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