Security

package
v0.1.4-0...-4d5b6ff Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const UIDKey string = "uID"

Variables

View Source
var Login = LoginCred{}
View Source
var RemoteVerificationState = RemoteVerification{}
View Source
var SecurityMap = make(map[string]SecurityResult)
View Source
var StoredJWTToken string = ""
View Source
var X_Api_Key_Map = sync.Map{}

Functions

func GenNewBusinessJWT

func GenNewBusinessJWT(email string, permission string, secret string) (string, error)

func GiveToken

func GiveToken(token string, rw http.ResponseWriter, req *http.Request)

func IsJWTValid

func IsJWTValid(credential string) (string, string, bool)

func Oauth

func Oauth() http.HandlerFunc

func ParseUserPermissionJWT

func ParseUserPermissionJWT(j_token string, secret string) (string, error)

func Remote_Verify_Middleware

func Remote_Verify_Middleware(h http.Handler) http.Handler

func Signup

func Signup()

func X_Api_Key

func X_Api_Key(r *http.Request) bool

func X_Api_Key_Middleware

func X_Api_Key_Middleware(h http.Handler) http.Handler

Types

type LoginCred

type LoginCred struct {
	User     string `json:"user"`
	Password string `json:"password"`
}

type OauthLoginFEResponse

type OauthLoginFEResponse struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   int32  `json:"expires_in"`
	Scope       string `json:"scope"`
}

type OauthLoginRequest

type OauthLoginRequest struct {
	User     string `json:"user"`
	Password string `json:"password"`
}

type OauthLoginResponse

type OauthLoginResponse struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   int32  `json:"expires_in"`
	Scope       string `json:"scope"`
}

type OauthUserInfoResponse

type OauthUserInfoResponse struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   int32  `json:"expires_in"`
	Scope       string `json:"scope"`
}

type RemoteVerification

type RemoteVerification struct {
	Addr          string
	Secret        string
	Last_verified time.Time
	Ok            bool
	CheckTime     time.Duration
}

type RemoteVerificationConfig

type RemoteVerificationConfig struct {
	Enabled            bool   `json:"enabled"`
	Secret             string `json:"secret"`
	ServeEndpointLocal bool   `json:"serve_endpoint_local"`
}

type Request

type Request struct {
	User     string `json:"user"`
	Password string `json:"password"`
}

type SecurityIpRange

type SecurityIpRange = map[string][]string

type SecurityResult

type SecurityResult struct {
	ConfigValue string
	Bool        bool
	ErrorMsg    string
}

Jump to

Keyboard shortcuts

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