Documentation
¶
Index ¶
- Constants
- func GetIDPSyncStatus() models.IDPSyncStatus
- func GetMatchingUser(oauthUser *OAuthUser) (*schema.User, error)
- func HandleAuthCallback(w http.ResponseWriter, r *http.Request)
- func HandleAuthLogin(w http.ResponseWriter, r *http.Request)
- func HandleHeadlessSSO(w http.ResponseWriter, r *http.Request)
- func HandleHeadlessSSOCallback(w http.ResponseWriter, r *http.Request)
- func HandleHostSSOCallback(w http.ResponseWriter, r *http.Request)
- func InitializeAuthProvider() string
- func IsOAuthConfigured() bool
- func RegisterHostSSO(w http.ResponseWriter, r *http.Request)
- func ResetAuthProvider()
- func ResetIDPSyncHook()
- func SyncFromIDP() error
- type OAuthUser
- type StringOrInt
Constants ¶
const OIDC_TIMEOUT = 10 * time.Second
Variables ¶
This section is empty.
Functions ¶
func GetIDPSyncStatus ¶
func GetIDPSyncStatus() models.IDPSyncStatus
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