Documentation ¶
Index ¶
- Constants
- Variables
- func AnError(hdlr *AesSrpType, www http.ResponseWriter, req *http.Request, httpCode int, ...)
- func AnErrorRv(hdlr *AesSrpType, www http.ResponseWriter, req *http.Request, httpCode int, ...) (rv string)
- func CheckMayAccessApi(hdlr *AesSrpType, rw *goftlmux.MidBuffer, SandBoxPrefix string, ...) (ok bool)
- func CmpBackupKeys(hdlr *AesSrpType, salt string, set string, to string) (hash string, found bool, hv string)
- func ConfigEmailAWS(hdlr *AesSrpType, file string)
- func DbDel(hdlr *AesSrpType, rw *goftlmux.MidBuffer, key string)
- func DbExpire(hdlr *AesSrpType, rw *goftlmux.MidBuffer, key string, life int) (err error)
- func DbFetchUser(hdlr *AesSrpType, rw *goftlmux.MidBuffer, req *http.Request, username string, ...) (salt string, verif string, mdata map[string]string, err error)
- func DbFetchUserMdata(hdlr *AesSrpType, rw *goftlmux.MidBuffer, username, SandBoxPrefix string) (mdata map[string]string, err error)
- func DbGetString(hdlr *AesSrpType, rw *goftlmux.MidBuffer, key string) (rkey string, err error)
- func DbSandboxKey(hdlr *AesSrpType, key string) (rkey string)
- func DbSetExpire(hdlr *AesSrpType, rw *goftlmux.MidBuffer, key string, val string, life int) (err error)
- func DbSetString(hdlr *AesSrpType, rw *goftlmux.MidBuffer, key string, val string) (err error)
- func DecryptData(hdlr *AesSrpType, rw *goftlmux.MidBuffer, www http.ResponseWriter, ...) (plaintext, key []byte, err error)
- func EncryptData(hdlr *AesSrpType, www http.ResponseWriter, req *http.Request, ...) (rv string, err error)
- func GenBackupKeys(hdlr *AesSrpType, salt string, prefix string, www http.ResponseWriter, ...) (raw string, hash string)
- func GenRandBytes(nRandBytes int) (buf []byte, err error)
- func GenRandNumber(nDigits int) (buf string, err error)
- func GenerateEmailAuthKey() (EmailAuthKey string)
- func GenerateRandomDeviceID() (DeviceID string)
- func GenerateRandomOneTimeKey(initialDigit string) (OneTimeKey string)
- func GenerateValidationSecret() (secret string)
- func GetDebugFlag(name string) (rv bool)
- func GetEmailAuth(hdlr *AesSrpType, rw *goftlmux.MidBuffer, emailAuthToken, SandBoxPrefix string) (email string, ok bool)
- func GetEmailFromIamI(hdlr *AesSrpType, rw *goftlmux.MidBuffer, SandBoxPrefix string, IamI string) (email, Etag string, err error)
- func GetEmailFromRegKey(regKey string) (email string, err error)
- func GetKeyData(hdlr *AesSrpType, rw *goftlmux.MidBuffer, tt, SandBoxPrefix string) (pw string, salt string, key string, iter int, keysize int, email string, ...)
- func GetKeyDataRaw(hdlr *AesSrpType, rw *goftlmux.MidBuffer, tt, SandBoxPrefix string) (key string, email string, ss map[string]interface{})
- func GetSalt(hdlr *AesSrpType, www http.ResponseWriter, req *http.Request, ...) (salt string, v string)
- func IsLoggedIn(hdlr *AesSrpType, rw *goftlmux.MidBuffer, ps goftlmux.Params) (rv bool)
- func SandBoxKey(pre, sandbox, key string) (rKey string)
- func Save2FactorAuth(hdlr *AesSrpType, rw *goftlmux.MidBuffer, ...)
- func SaveAsList(orig string, item string) (rv string)
- func SaveCookieAuth(hdlr *AesSrpType, rw *goftlmux.MidBuffer, ...)
- func SaveEmailAuth(hdlr *AesSrpType, rw *goftlmux.MidBuffer, ...)
- func SaveInitData(hdlr *AesSrpType, rw *goftlmux.MidBuffer, ...) (err error)
- func SaveInitFailedLogin(hdlr *AesSrpType, rw *goftlmux.MidBuffer, tt, SandBoxPrefix string) (err error)
- func SaveKeyData(hdlr *AesSrpType, rw *goftlmux.MidBuffer, tt, SandBoxPrefix string, ...) (err error)
- func SaveLogoutData(hdlr *AesSrpType, rw *goftlmux.MidBuffer, tt, SandBoxPrefix string) (err error)
- func SaveSupportMessage(rw *goftlmux.MidBuffer, fr, sub, bod string)
- func SendEmailViaAWS(hdlr *AesSrpType, email_addr string, app string, tmpl string, pw string, ...)
- func SendEmailViaAWS_support(hdlr *AesSrpType, email_addr string, app string, tmpl string, ...)
- func SetDebugFlag(name string, to bool)
- func SetDebugFlagsFromGlobal(gCfg *cfg.ServerGlobalConfigType)
- func SetEmailFromIamI(hdlr *AesSrpType, rw *goftlmux.MidBuffer, SandBoxPrefix string, ...) (err error)
- func SetLoggedIn(hdlr *AesSrpType, rw *goftlmux.MidBuffer, un, SandBoxPrefix, key string)
- func SetSaltV(hdlr *AesSrpType, www http.ResponseWriter, req *http.Request, ...)
- func SetupRoles(rolesName []string, accessLevels map[string][]string) ([]RolesWithBitMask, map[string]uint64, []RolesWithBitMask)
- func UpdateNotStayLoggedIn(hdlr *AesSrpType, rw *goftlmux.MidBuffer, SandBoxPrefix string, ...) (err error)
- func UpdateSessionEncryptionKey(hdlr *AesSrpType, rw *goftlmux.MidBuffer, tt, SandBoxPrefix string, ...) (err error)
- func UserGetEmail(hdlr *AesSrpType, rw *goftlmux.MidBuffer, tt, SandBoxPrefix string) (email string, err error)
- func ValidUUID(uuid string) (rv bool)
- func ValidateCookies(LoginAuthCookie, LoginHashCookie, validation_secret, email string) bool
- func ValidateEmail(email string) (rv bool)
- func XxSaveSessionData(hdlr *AesSrpType, rw *goftlmux.MidBuffer, tt, SandBoxPrefix string, ...) (err error)
- func XxSaveUserExists(hdlr *AesSrpType, rw *goftlmux.MidBuffer, tt, SandBoxPrefix string, ...) (err error)
- type AesSrpType
- func (hdlr *AesSrpType) CookieEmailMatch(rw *goftlmux.MidBuffer, email, cookie, SandBoxPrefix string) bool
- func (hdlr *AesSrpType) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, ...) (err error)
- func (hdlr *AesSrpType) IsValidAnonUserPath(path string) bool
- func (hdlr *AesSrpType) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, ...) (err error)
- func (hdlr *AesSrpType) ServeHTTP(www http.ResponseWriter, req *http.Request)
- func (hdlr *AesSrpType) UpsertUserInfo(userId string, mdata map[string]string)
- func (hdlr *AesSrpType) ValidUserName(un string) bool
- type DeviceIDType
- type LoginRetrunValue
- type LoginRetrunValueNo2fa
- type Ng_struct
- type RSaveToRedis
- func (rs *RSaveToRedis) RDeSerial(s string) (rv map[string]string)
- func (rs *RSaveToRedis) RGetValue(hdlr *AesSrpType, rw *goftlmux.MidBuffer, key string) (val map[string]string, ok bool)
- func (rs *RSaveToRedis) RGetValueRaw(hdlr *AesSrpType, rw *goftlmux.MidBuffer, key string) (val string, ok bool)
- func (rs *RSaveToRedis) RSerial(val map[string]string) (rv string)
- func (rs *RSaveToRedis) RSetValue(hdlr *AesSrpType, rw *goftlmux.MidBuffer, key string, val map[string]string)
- func (rs *RSaveToRedis) RUpdValue(hdlr *AesSrpType, rw *goftlmux.MidBuffer, key string, val map[string]string)
- type RSaveToRedisInterface
- type RolesWithBitMask
- type SecurityConfigType
Constants ¶
const InjectionTestMode = false // Allows *ERROR* injection to test.
Can only be change with re-compile const TestMode = true // if true allow /api/srp_simulate_email_confirm to do an email confirm const InDemoMode = true // Demo mode sends one time keys to user via registration email -- See also "SandBoxMode" -- and allows /api/srp_simulate_email_confirm to confirm email registration
const LoginAuthCookieLife = (1 * 24 * 60 * 60) // one day in seconds
const LoginHashCookieLife = (1 * 24 * 60 * 60) // one day in seconds
const SandBoxMode = true // Allow use of a database sandbox for testing and demos
Variables ¶
var AdminReservedIDs = map[string]bool{ "salt": true, "v": true, }
var ApiIn2faPendingMode = map[string]bool{ "/api/1x1.gif": true, "/api/cipher": true, "/api/confirm-registration": true, "/api/enc_version": true, "/api/get2FactorFromDeviceID": true, "/api/getPageToken": true, "/api/pwrecov2": true, "/api/send_support_message": true, "/api/setDebugFlags": true, "/api/setup_sandbox": true, "/api/srp_challenge": true, "/api/srp_email_confirm": true, "/api/srp_getNg": true, "/api/srp_login": true, "/api/srp_logout": true, "/api/srp_recover_password_pt1": true, "/api/srp_recover_password_pt2": true, "/api/srp_register": true, "/api/srp_simulate_email_confirm": true, "/api/srp_validate": true, "/api/valid2Factor": true, "/api/version": true, "/api/resumeLogin": true, }
xyzzyEEE
var DebugFlags = map[string]bool{ "DumpUnencryptedRequest": false, "DumpEncryptedReturnValue": false, "DumpEncryptedRequest": false, }
var DebugMutex sync.Mutex // Lock for map
var ErrEarlyExit = errors.New("Early Exit - return")
var ErrNoSuchUser = errors.New("User not found - no such user")
var MarkPageJS = `
var _v_ = %q;
function GetPageMarkerId(){ return _v_; }
`
var ReservedIDs = map[string]bool{ "$auth_key$": true, "$email$": true, "$$host_name$$": true, "$is_logged_in$": true, "$is_enc_logged_in$": true, "$is_anon_user$": true, "$is_full_login$": true, "$privs$": true, "$saved_one_time_key_hashed$": true, "$user_id$": true, "$username$": true, "LoginAuthCookie": true, "Method": true, "URL": true, "owner_email": true, "user_etag": true, "username": true, }
Overlap with ../cfg/cfg.io-1:w: var ReservedItems = map[string]bool{
var TestModeInject = map[string]bool{ "invalid-tt": true, "invalid-tt-change-password": false, }
============================================================================================================================================ Config -------------------------------------------------------------------------------- var EmailRelayIP string // Set during initialization var EmailAuthToken string // Set during initialization
Functions ¶
func AnError ¶
func AnError(hdlr *AesSrpType, www http.ResponseWriter, req *http.Request, httpCode int, code int, msg string)
----------------------------------------------------------------------------------------------------------------------------
func AnErrorRv ¶
func AnErrorRv(hdlr *AesSrpType, www http.ResponseWriter, req *http.Request, httpCode int, code int, msg string) (rv string)
func CheckMayAccessApi ¶
func CmpBackupKeys ¶
func CmpBackupKeys(hdlr *AesSrpType, salt string, set string, to string) (hash string, found bool, hv string)
---------------------------------------------------------------------------------------------------------------------------- Input
set the set of backup keys, hashed salt the users passwrod salt to key we are compareing to
Output
hash new 'set' - after removing matched item if one found found true if a match was found
func ConfigEmailAWS ¶
func ConfigEmailAWS(hdlr *AesSrpType, file string)
func DbFetchUser ¶
func DbFetchUser(hdlr *AesSrpType, rw *goftlmux.MidBuffer, req *http.Request, username string, SandBoxPrefix string) (salt string, verif string, mdata map[string]string, err error)
Input username(email) fetch back the user informaiton - decrypt salt/v the verify value
func DbFetchUserMdata ¶
func DbFetchUserMdata(hdlr *AesSrpType, rw *goftlmux.MidBuffer, username, SandBoxPrefix string) (mdata map[string]string, err error)
Input username(email) fetch back the user information
func DbGetString ¶
func DbSandboxKey ¶
func DbSandboxKey(hdlr *AesSrpType, key string) (rkey string)
This didn't work correctly so....
func DbSetExpire ¶
func DbSetExpire(hdlr *AesSrpType, rw *goftlmux.MidBuffer, key string, val string, life int) (err error)
----------------------------------------------------------------------------------------------------------------------------
func DbSetString ¶
----------------------------------------------------------------------------------------------------------------------------
func DecryptData ¶
func DecryptData(hdlr *AesSrpType, rw *goftlmux.MidBuffer, www http.ResponseWriter, req *http.Request, SandBoxPrefix, Password, tEmail, tSalt string, encData *sjcl.SJCL_DataStruct, tIter, tKeySize int, tKey string, Session map[string]interface{}, tt string, debugFlag1, debugFlag2 bool) (plaintext, key []byte, err error)
func EncryptData ¶
func EncryptData(hdlr *AesSrpType, www http.ResponseWriter, req *http.Request, Salt base64data.Base64Data, Iter int, KeySize int, tt string, plaintext, key []byte, debugFlag1, debugFlag2 bool) (rv string, err error)
func GenBackupKeys ¶
func GenBackupKeys(hdlr *AesSrpType, salt string, prefix string, www http.ResponseWriter, req *http.Request) (raw string, hash string)
----------------------------------------------------------------------------------------------------------------------------
func GenRandBytes ¶
============================================================================================================================================ Should move to aesccm package
func GenRandNumber ¶
Generate a random number, 0..N, returned as a string with 6 to 8 non-zero digits.
func GenerateEmailAuthKey ¶
func GenerateEmailAuthKey() (EmailAuthKey string)
func GenerateRandomDeviceID ¶
func GenerateRandomDeviceID() (DeviceID string)
func GenerateValidationSecret ¶
func GenerateValidationSecret() (secret string)
mdata["validation_secret"] = GenerateValidationSecret() //
func GetEmailAuth ¶
func GetEmailFromIamI ¶
func GetEmailFromIamI(hdlr *AesSrpType, rw *goftlmux.MidBuffer, SandBoxPrefix string, IamI string) (email, Etag string, err error)
etag, err := GetEtagFromIamI ( IamI )
============================================================================================================================================
func GetEmailFromRegKey ¶
---------------------------------------------------------------------------------------------------------------------------- email, err = GetEmailFromRegKey ( regKey )
func GetKeyData ¶
func GetKeyData(hdlr *AesSrpType, rw *goftlmux.MidBuffer, tt, SandBoxPrefix string) (pw string, salt string, key string, iter int, keysize int, email string, ss map[string]interface{})
============================================================================================================================================ ============================================================================================================================================ 1. Lookup user based on tt the session id - in Redis opts.Password, encData.Salt, encData.Iter, encData.KeySizeBytes = GetKeyData ( email, tt )
func GetKeyDataRaw ¶
func GetKeyDataRaw(hdlr *AesSrpType, rw *goftlmux.MidBuffer, tt, SandBoxPrefix string) (key string, email string, ss map[string]interface{})
============================================================================================================================================ ============================================================================================================================================ 1. Lookup user based on tt the session id - in Redis opts.Password, encData.Salt, encData.Iter, encData.KeySizeBytes = GetKeyData ( email, tt )
func GetSalt ¶
func GetSalt(hdlr *AesSrpType, www http.ResponseWriter, req *http.Request, mdata map[string]string) (salt string, v string)
Beginning of encrypting salt/v in Redis Check www.hdrl.PasswordSV - if not "", then use that to decrypt PasswordSV - encpyt before saving
func IsLoggedIn ¶
func SandBoxKey ¶
func Save2FactorAuth ¶
func Save2FactorAuth(hdlr *AesSrpType, rw *goftlmux.MidBuffer, cookieValue, SandBoxPrefix, email string)
----------------------------------------------------------------------------------------------------------------------------
func SaveAsList ¶
func SaveCookieAuth ¶
func SaveCookieAuth(hdlr *AesSrpType, rw *goftlmux.MidBuffer, cookieValue, SandBoxPrefix, ip, email, hash, id, privs string)
func SaveEmailAuth ¶
func SaveEmailAuth(hdlr *AesSrpType, rw *goftlmux.MidBuffer, email, SandBoxPrefix, emailAuthToken string)
func SaveInitData ¶
func SaveInitData(hdlr *AesSrpType, rw *goftlmux.MidBuffer, tt, SandBoxPrefix, pw, email, key, privs string) (err error)
============================================================================================================================================
func SaveInitFailedLogin ¶
func SaveInitFailedLogin(hdlr *AesSrpType, rw *goftlmux.MidBuffer, tt, SandBoxPrefix string) (err error)
============================================================================================================================================
func SaveKeyData ¶
func SaveKeyData(hdlr *AesSrpType, rw *goftlmux.MidBuffer, tt, SandBoxPrefix string, pw, salt, key string, iter int, keysize int) (err error)
============================================================================================================================================
func SaveLogoutData ¶
func SaveLogoutData(hdlr *AesSrpType, rw *goftlmux.MidBuffer, tt, SandBoxPrefix string) (err error)
============================================================================================================================================
func SaveSupportMessage ¶
func SendEmailViaAWS ¶
func SendEmailViaAWS(hdlr *AesSrpType, email_addr string, app string, tmpl string, pw string, email_auth_token string)
============================================================================================================================================ s, err := client.Get(fmt.Sprintf("https://52.21.71.211/api/send?auth_token=Dg9Tp4ecr8Y3H19lQZtGwFX3ug&app=%s&tmpl=%s&to=%s&from=no-reply@2c-why.com&p1=%s",
func SendEmailViaAWS_support ¶
func SendEmailViaAWS_support(hdlr *AesSrpType, email_addr string, app string, tmpl string, to, sub, bod string)
============================================================================================================================================
func SetDebugFlag ¶
Set a debug flag to t/f - if not exists then just set new flag.
func SetDebugFlagsFromGlobal ¶
func SetDebugFlagsFromGlobal(gCfg *cfg.ServerGlobalConfigType)
use data from global-cfg.json to set local debug flags
func SetEmailFromIamI ¶
func SetEmailFromIamI(hdlr *AesSrpType, rw *goftlmux.MidBuffer, SandBoxPrefix string, IamI, email string) (err error)
============================================================================================================================================ update Etag stuff with email // mark Etag as = if aMap["hasLoggedIn"] != "" {
func SetLoggedIn ¶
func SetLoggedIn(hdlr *AesSrpType, rw *goftlmux.MidBuffer, un, SandBoxPrefix, key string)
func SetSaltV ¶
func SetSaltV(hdlr *AesSrpType, www http.ResponseWriter, req *http.Request, mdata map[string]string, salt string, v string)
Beginning of encrypting salt/v in Redis Check www.hdrl.PasswordSV - if not "", then use that to decrypt PasswordSV - encpyt before saving
func SetupRoles ¶
func SetupRoles(rolesName []string, accessLevels map[string][]string) ([]RolesWithBitMask, map[string]uint64, []RolesWithBitMask)
This is per-server
func UpdateNotStayLoggedIn ¶
func UpdateNotStayLoggedIn(hdlr *AesSrpType, rw *goftlmux.MidBuffer, SandBoxPrefix string, IamI, email string) (err error)
============================================================================================================================================ update Etag stuff with email // mark Etag as = if aMap["hasLoggedIn"] != "" {
func UpdateSessionEncryptionKey ¶
func UpdateSessionEncryptionKey(hdlr *AesSrpType, rw *goftlmux.MidBuffer, tt, SandBoxPrefix string, keyInHex string, data map[string]interface{}) (err error)
_ = UpdateSessionEncryptionKey(hdlr, rw, tt, SandBoxPrefix, tmp_login_mdata["key2"], raw_session)
func UserGetEmail ¶
func UserGetEmail(hdlr *AesSrpType, rw *goftlmux.MidBuffer, tt, SandBoxPrefix string) (email string, err error)
============================================================================================================================================
func ValidateCookies ¶
============================================================================================================================================ mdata["LoginAuthCookie"] = SaveAsList(mdata["LoginAuthCookie"], cookieValue) cookie2 := http.Cookie{Name: "LoginHashCookie", Value: cookieHash, Path: "/", Expires: expire, RawExpires: expire.Format(time.UnixDate), MaxAge: LoginHashCookieLife, Secure: secure, HttpOnly: true}
func ValidateEmail ¶
Validate an email address. True if valid.
func XxSaveSessionData ¶
func XxSaveSessionData(hdlr *AesSrpType, rw *goftlmux.MidBuffer, tt, SandBoxPrefix string, session map[string]interface{}) (err error)
============================================================================================================================================ need to do a get/merge at this point to preserve any additional data in key. (Session Data like "email address")
func XxSaveUserExists ¶
func XxSaveUserExists(hdlr *AesSrpType, rw *goftlmux.MidBuffer, tt, SandBoxPrefix string, session map[string]interface{}) (err error)
============================================================================================================================================
Types ¶
type AesSrpType ¶
type AesSrpType struct { Next http.Handler // Paths []string // List of start paths where encryption will be used EncReqPaths []string // start with same as Paths, but require encryption/login MatchPaths []string // Paths that match this are allowed without authentication. (Static files for example) Bits int // Usually 2048 - number of bits for SRP authentication modulo number NGData Ng_struct // You can supply both the Bits and the actual n, G data SendStatusOnError bool // Respond to errors with non-200 status (i.e. 4xx and 5xx errors) AdminPassword string // If compiled in "TestMode" then this can be used to authenticate users - ignored otherwise FailedLoginThreshold int // Number of failed logins before a delay is inserted, 10 by default. NewUserPrivs string // What is a new users default privilege (role) SendEmail bool // If true, then emails will be sent using the AWS email relay code. EmailApp string // default user-login, the login demo, set to something else for a different set of templates KermitRule bool // If true, then emails to kermit.*@the-green-pc.com will not be sent (used for testing) EmailConfigFileName string // name of file to take Email config from SupportEmailTo string // Request for help and support emails go to this address TwoFactorRequired string // If "y" then 2-factor-authentication is turned on BackupKeyIter int // Number of iterations for running pbkdf2 on backup one time keys, default 1000 KeyIter int // Number of iterations for running pbkdf2 on login passwords, default 1000 (mates with value in JS/Client code) BackupKeySizeBytes int // Key size for backup one-time keys, default 16 CookieExpireInXDays int // CookieExpireInXDays2 int // SessionLife int // KeySessionLife int // CookieSessionLife int // TwoFactorLife int // how long is a temporary 2 factor key good for - 5 min + 1 min grace PreEau string // Redis Prefix: "eau:" PreKey string // Redis Prefix: "ses:" PreAuth string // Redis Prefix: "aut:" Pre2Factor string // Redis Prefix: "p2f:" // Key used for 2fa:DeviceID -> OneTimeKey PwResetKey string // Redis Prefix: "pwr:" // Key for password recovery token - Exipre is PwExpireIn PwExpireIn int // Default 86400 == 1 day in seconds, time for password recovery TestModeInject []string // Array of strings to inject values - after auth converted to global variable for injecting errors - used only in test mode. PasswordSV string // SandBoxExpreTime int // about 2 hours SecurityAccessLevelsName map[string][]string // SecurityPrivilages map[string][]string // StayLoggedInExpire int // in seconds, time for login to persist when "stayLoggedIn" is true: 86400 = 1 day. UserNameForRegister bool // default false, use email for username SecurityConfig SecurityConfigType // PwRecoverTemplate1 string // PwRecoverTemplate2 string // PwRecoverTemplate3 string // RegTemplate1 string // RegTemplate2 string // RegTemplate3 string // RegTemplate4 string // AllowReregisterDeviceID bool // If true (Defaults to false) then will allow re-register of DeviceID (same id). Good for development and testing only. LimitDeviceIDs int // InDemoMode bool // InTestMode bool // DbUserColAPI string // DbUserCols []string // DbUserColsDb []string // AnonUserPaths []string // Set of additional paths that will be allowed to a "anon-user", if path starts with "-" then it will be delete from set. NonEmailAccts []string // Set of account names like "admin" that need not be email addresses LineNo int // Lin in input file // contains filtered or unexported fields }
--------------------------------------------------------------------------------------------------------------------------
func GetRwHdlrFromWWW ¶
func GetRwHdlrFromWWW(www http.ResponseWriter, req *http.Request) (rw *goftlmux.MidBuffer, hdlr *AesSrpType, ok bool)
============================================================================================================================================
func NewAesSrpServer ¶
func NewAesSrpServer(n http.Handler, p []string, e []string, gCfg *cfg.ServerGlobalConfigType) *AesSrpType
func (*AesSrpType) CookieEmailMatch ¶
func (hdlr *AesSrpType) CookieEmailMatch(rw *goftlmux.MidBuffer, email, cookie, SandBoxPrefix string) bool
func (*AesSrpType) InitializeWithConfigData ¶
func (hdlr *AesSrpType) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)
func (*AesSrpType) IsValidAnonUserPath ¶
func (hdlr *AesSrpType) IsValidAnonUserPath(path string) bool
if mdata["auth"] == "" && mdata["acct_type"] == "anon-user" && hdlr.TwoFactorRequired == "n" && hdlr.IsValidAnonUserPath(newPath0) {
func (*AesSrpType) PreValidate ¶
func (hdlr *AesSrpType) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)
func (*AesSrpType) ServeHTTP ¶
func (hdlr *AesSrpType) ServeHTTP(www http.ResponseWriter, req *http.Request)
func (*AesSrpType) UpsertUserInfo ¶
func (hdlr *AesSrpType) UpsertUserInfo(userId string, mdata map[string]string)
Ok -- this is a really rotten way to implement this - but it will work for the moment. All of this should be passed down-stack to TabServer2 - via a rewrite of the call and a .Next -- When this is fixed remember to remove the connect to the database.
func (*AesSrpType) ValidUserName ¶
func (hdlr *AesSrpType) ValidUserName(un string) bool
ValidUserName returns true if this is a non-email valid user name, like "admin" } else hdlr.ValidUserName(email) {
type DeviceIDType ¶
type DeviceIDType struct { DeviceID string CreationDate string // Rfc3339 format date Title string // Description of Device - optional }
xyzzyDeviceID - management calls for multiple DeviceID's - list of them, delete one, add one, update name on DeviceID
type LoginRetrunValue ¶
type LoginRetrunValue struct { Status string `json:"status"` M2 string `json:"M2"` FirstLogin bool `json:"first_login"` MoreBackupKeys bool `json:"more_backup_keys"` TwoFactorRequired string `json:"TwoFactorRequired"` UserRole RolesWithBitMask `json:"userRole"` DeviceID string `json:"DeviceID"` // xyzzyDeviceID DeviceIDList []DeviceIDType `json:"DeviceIDList"` BackupKeys string `json:"BackupKeys"` OwnerEmail string `json:"OwnerEmail"` LoginLastsTill string `json:"LoginLastsTill"` LoginLastsSeconds int `json:"LoginLastsSeconds"` RealName string `json:"RealName"` PhoneNo string `json:"PhoneNo"` FirstName string `json:"FirstName"` MidName string `json:"MidName"` LastName string `json:"LastName"` UserName string `json:"UserName"` XAttrs string `json:"-"` HaveAnon bool `json:"have_anon"` }
fmt.Fprintf(www, `{"status":"success","M2":"%s","first_login":%v,"more_backup_keys":%v,"TwoFactorRequired":%v}`, m2, first_login, more_backup_keys, TwoFactorRequired)
type LoginRetrunValueNo2fa ¶
type LoginRetrunValueNo2fa struct { Status string `json:"status"` M2 string `json:"M2"` FirstLogin bool `json:"first_login"` TwoFactorRequired string `json:"TwoFactorRequired"` UserRole RolesWithBitMask `json:"userRole"` OwnerEmail string `json:"OwnerEmail"` LoginLastsTill string `json:"LoginLastsTill"` LoginLastsSeconds int `json:"LoginLastsSeconds"` RealName string `json:"RealName"` PhoneNo string `json:"PhoneNo"` FirstName string `json:"FirstName"` MidName string `json:"MidName"` LastName string `json:"LastName"` UserName string `json:"UserName"` XAttrs string `json:"-"` HaveAnon bool `json:"have_anon"` }
type RSaveToRedis ¶
============================================================================================================================================ /////////////////////////////// redis non-sim /////////////////////////////////////////////////////////////////////////
func NewRSaveToRedis ¶
func NewRSaveToRedis(pre string) *RSaveToRedis
func (*RSaveToRedis) RGetValue ¶
func (rs *RSaveToRedis) RGetValue(hdlr *AesSrpType, rw *goftlmux.MidBuffer, key string) (val map[string]string, ok bool)
func (*RSaveToRedis) RGetValueRaw ¶
func (rs *RSaveToRedis) RGetValueRaw(hdlr *AesSrpType, rw *goftlmux.MidBuffer, key string) (val string, ok bool)
func (*RSaveToRedis) RSetValue ¶
func (rs *RSaveToRedis) RSetValue(hdlr *AesSrpType, rw *goftlmux.MidBuffer, key string, val map[string]string)
func (*RSaveToRedis) RUpdValue ¶
func (rs *RSaveToRedis) RUpdValue(hdlr *AesSrpType, rw *goftlmux.MidBuffer, key string, val map[string]string)
type RSaveToRedisInterface ¶
type RSaveToRedisInterface interface { RSetValue(hdlr *AesSrpType, rw *goftlmux.MidBuffer, key string, val map[string]string) RGetValue(hdlr *AesSrpType, rw *goftlmux.MidBuffer, key string) (val map[string]string, ok bool) RGetValueRaw(hdlr *AesSrpType, rw *goftlmux.MidBuffer, key string) (val string, ok bool) RUpdValue(hdlr *AesSrpType, rw *goftlmux.MidBuffer, key string, val map[string]string) }