auth

package
v0.0.0-...-503ec33 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextKeyUser   = "CONTEXT_USER"
	ContextKeyClient = "CONTEXT_CLIENT"

	ContextKeyAuthStatus = "CONTEXT_AUTH_STATUS"

	ContextKeyAuthFailed = "CONTEXT_AUTH_FAILED"

	ContextKeyDirectLoginFormat = "CONTEXT_DIRECT_LOGIN_FORMAT"

	ContextKeyPartialSuccessMethod = "CONTEXT_PARTIAL_SUCCESS_METHOD"
)
View Source
const (
	SeparatorATSign   = "@"
	SeparatorHashMark = "#"
)
View Source
const (
	ErrLoginConfirmWait     = "login_confirm_wait"
	ErrLoginConfirmRejected = "login_confirm_rejected"
	ErrLoginConfirmRequired = "login_confirm_required"
	ErrMFARequired          = "mfa_required"
	ErrPasswordFailed       = "password_failed"
)

Variables

This section is empty.

Functions

func CreateSelectOptionsQuestion

func CreateSelectOptionsQuestion(options []string) string

func GetUsernameFromSSHCtx

func GetUsernameFromSSHCtx(ctx ssh.Context) string

func HTTPMiddleDebugAuth

func HTTPMiddleDebugAuth() gin.HandlerFunc

func HTTPMiddleSessionAuth

func HTTPMiddleSessionAuth(jmsService *service.JMService) gin.HandlerFunc

func SSHAuthLogCallback

func SSHAuthLogCallback(ctx ssh.Context, method string, err error)

func SSHKeyboardInteractiveAuth

func SSHKeyboardInteractiveAuth(ctx ssh.Context, challenger gossh.KeyboardInteractiveChallenge) (res ssh.AuthResult)

Types

type DirectLoginAssetReq

type DirectLoginAssetReq struct {
	Username        string
	Protocol        string
	AccountUsername string
	AssetTarget     string
	ConnectToken    *model.ConnectToken
}

func ParseDirectUserFormat

func ParseDirectUserFormat(s string) (DirectLoginAssetReq, bool)

func (*DirectLoginAssetReq) Authenticate

func (d *DirectLoginAssetReq) Authenticate(password string) bool

func (*DirectLoginAssetReq) IsToken

func (d *DirectLoginAssetReq) IsToken() bool

func (*DirectLoginAssetReq) User

func (d *DirectLoginAssetReq) User() string

type LoginReviewService

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

func NewLoginReview

func NewLoginReview(jmsService *service.JMService, opts ...ReviewOption) LoginReviewService

func (*LoginReviewService) GetProcessor

func (c *LoginReviewService) GetProcessor() string

func (*LoginReviewService) GetReviewers

func (c *LoginReviewService) GetReviewers() []string

func (*LoginReviewService) GetTicketUrl

func (c *LoginReviewService) GetTicketUrl() string

func (*LoginReviewService) WaitLoginConfirm

func (c *LoginReviewService) WaitLoginConfirm(ctx context.Context) Status

type ReviewOption

type ReviewOption func(*reviewOption)

func WithReviewTokenInfo

func WithReviewTokenInfo(info *model.ConnectTokenInfo) ReviewOption

func WithReviewUser

func WithReviewUser(user *model.User) ReviewOption

type SSHAuthFunc

type SSHAuthFunc func(ctx ssh.Context, password, publicKey string) (res ssh.AuthResult)

func SSHPasswordAndPublicKeyAuth

func SSHPasswordAndPublicKeyAuth(jmsService *service.JMService) SSHAuthFunc

type Status

type Status int
const (
	StatusApprove Status = iota + 1
	StatusReject
	StatusCancel
)

type StatusAuth

type StatusAuth int64

type UserAuthClient

type UserAuthClient struct {
	*service.UserClient
	// contains filtered or unexported fields
}

func (*UserAuthClient) Authenticate

func (u *UserAuthClient) Authenticate(ctx context.Context) (user model.User, authStatus StatusAuth)

func (*UserAuthClient) CancelConfirm

func (u *UserAuthClient) CancelConfirm()

func (*UserAuthClient) CheckConfirm

func (u *UserAuthClient) CheckConfirm(ctx context.Context) (user model.User, authStatus StatusAuth)

func (*UserAuthClient) CheckConfirmAuth

func (u *UserAuthClient) CheckConfirmAuth(ctx ssh.Context, challenger gossh.KeyboardInteractiveChallenge) (ok bool)

func (*UserAuthClient) CheckMFAAuth

func (u *UserAuthClient) CheckMFAAuth(ctx ssh.Context, challenger gossh.KeyboardInteractiveChallenge) (ok bool)

func (*UserAuthClient) CheckUserOTP

func (u *UserAuthClient) CheckUserOTP(ctx context.Context, MFAType string, code string) (user model.User, authStatus StatusAuth)

func (*UserAuthClient) GetMFAOptions

func (u *UserAuthClient) GetMFAOptions() []string

func (*UserAuthClient) SetOption

func (u *UserAuthClient) SetOption(setters ...service.UserClientOption)

Jump to

Keyboard shortcuts

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