Documentation ¶
Index ¶
- Constants
- type Service
- func (service *Service) APIDocs(w http.ResponseWriter, request *http.Request)
- func (service *Service) AddRoutes(router *mux.Router)
- func (service *Service) Check2FASMSConfirmation(w http.ResponseWriter, request *http.Request)
- func (service *Service) CheckRegistrationEmailConfirmation(w http.ResponseWriter, r *http.Request)
- func (service *Service) CheckRegistrationSMSConfirmation(w http.ResponseWriter, r *http.Request)
- func (service *Service) EmailRegistrationValidation(w http.ResponseWriter, r *http.Request)
- func (service *Service) EmailValidation(w http.ResponseWriter, request *http.Request)
- func (service *Service) ErrorPage(w http.ResponseWriter, request *http.Request)
- func (service *Service) FacebookCallback(w http.ResponseWriter, request *http.Request)
- func (service *Service) ForgetAccountHandler(w http.ResponseWriter, r *http.Request)
- func (service *Service) ForgotPassword(w http.ResponseWriter, request *http.Request)
- func (service *Service) GetConfig(w http.ResponseWriter, request *http.Request)
- func (service *Service) GetLoggedInUser(request *http.Request, w http.ResponseWriter) (username string, err error)
- func (service *Service) GetOauthUser(r *http.Request, w http.ResponseWriter) (username string, err error)
- func (service *Service) GetOrganizationInvitation(w http.ResponseWriter, request *http.Request)
- func (service *Service) GetSession(request *http.Request, kind SessionType, name string) (*sessions.Session, error)
- func (service *Service) GetSmsCode(w http.ResponseWriter, request *http.Request)
- func (service *Service) GetTwoFactorAuthenticationMethods(w http.ResponseWriter, request *http.Request)
- func (service *Service) GithubCallback(w http.ResponseWriter, request *http.Request)
- func (service *Service) HomePage(w http.ResponseWriter, request *http.Request)
- func (service *Service) InitModels()
- func (service *Service) LoginResendPhonenumberConfirmation(w http.ResponseWriter, request *http.Request)
- func (service *Service) Logout(w http.ResponseWriter, request *http.Request)
- func (service *Service) MobileSMSConfirmation(w http.ResponseWriter, request *http.Request)
- func (service *Service) PhonenumberRegistrationValidation(w http.ResponseWriter, r *http.Request)
- func (service *Service) PhonenumberValidation(w http.ResponseWriter, request *http.Request)
- func (service *Service) PhonenumberValidationAndLogin(w http.ResponseWriter, request *http.Request)
- func (service *Service) Process2FASMSConfirmation(w http.ResponseWriter, request *http.Request)
- func (service *Service) ProcessLoginForm(w http.ResponseWriter, request *http.Request)
- func (service *Service) ProcessPhonenumberConfirmationForm(w http.ResponseWriter, r *http.Request)
- func (service *Service) ProcessRegistrationForm(w http.ResponseWriter, r *http.Request)
- func (service *Service) ProcessTOTPConfirmation(w http.ResponseWriter, request *http.Request)
- func (service *Service) ResendValidationInfo(w http.ResponseWriter, r *http.Request)
- func (service *Service) ResetPassword(w http.ResponseWriter, request *http.Request)
- func (service *Service) ServeForgetAccountPage(w http.ResponseWriter, r *http.Request)
- func (service *Service) SetAPIAccessToken(w http.ResponseWriter, token string) (err error)
- func (service *Service) SetLoggedInOauthUser(w http.ResponseWriter, r *http.Request, username string) (err error)
- func (service *Service) SetLoggedInUser(w http.ResponseWriter, request *http.Request, username string) (err error)
- func (service *Service) SetWebUserMiddleWare(next http.Handler) http.Handler
- func (service *Service) ShowAuthorizeForm(w http.ResponseWriter, r *http.Request)
- func (service *Service) ShowLoginForm(w http.ResponseWriter, request *http.Request)
- func (service *Service) ShowPublicSite(w http.ResponseWriter, request *http.Request)
- func (service *Service) ShowRegistrationForm(w http.ResponseWriter, request *http.Request)
- func (service *Service) ValidateEmail(w http.ResponseWriter, r *http.Request)
- func (service *Service) ValidateInfo(w http.ResponseWriter, r *http.Request)
- type SessionType
Constants ¶
const (
MAX_PENDING_REGISTRATION_COUNT = 10000
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct { Sessions map[SessionType]*sessions.CookieStore EmailService communication.EmailService // contains filtered or unexported fields }
Service is the identityserver http service
func NewService ¶
func NewService(cookieSecret string, smsService communication.SMSService, emailService communication.EmailService, identityservice *identityservice.Service, version string, testEnv bool) (service *Service)
NewService creates and initializes a Service
func (*Service) APIDocs ¶
func (service *Service) APIDocs(w http.ResponseWriter, request *http.Request)
APIDocs shows the api documentation
func (*Service) Check2FASMSConfirmation ¶
func (service *Service) Check2FASMSConfirmation(w http.ResponseWriter, request *http.Request)
Check2FASMSConfirmation is called by the sms code form to check if the sms is already confirmed on the mobile phone
func (*Service) CheckRegistrationEmailConfirmation ¶ added in v0.9.15
func (service *Service) CheckRegistrationEmailConfirmation(w http.ResponseWriter, r *http.Request)
CheckRegistrationEmailConfirmation is called by the regisration form to check if the email is already confirmed
func (*Service) CheckRegistrationSMSConfirmation ¶
func (service *Service) CheckRegistrationSMSConfirmation(w http.ResponseWriter, r *http.Request)
CheckRegistrationSMSConfirmation is called by the sms code form to check if the sms is already confirmed on the mobile phone
func (*Service) EmailRegistrationValidation ¶ added in v1.0.0
func (service *Service) EmailRegistrationValidation(w http.ResponseWriter, r *http.Request)
EmailRegistrationValidation handles the email validation in the login flow
func (*Service) EmailValidation ¶
func (service *Service) EmailValidation(w http.ResponseWriter, request *http.Request)
EmailValidation is the page linked to the confirm email button in the email validation email
func (*Service) ErrorPage ¶
func (service *Service) ErrorPage(w http.ResponseWriter, request *http.Request)
ErrorPage shows the errorpage
func (*Service) FacebookCallback ¶
func (service *Service) FacebookCallback(w http.ResponseWriter, request *http.Request)
func (*Service) ForgetAccountHandler ¶ added in v0.9.16
func (service *Service) ForgetAccountHandler(w http.ResponseWriter, r *http.Request)
ForgetAccountHandler handles the actuall "forgetting" of an account, by dropping the validated email and phone numbers from the respective collections
func (*Service) ForgotPassword ¶
func (service *Service) ForgotPassword(w http.ResponseWriter, request *http.Request)
ForgotPassword handler for POST /login/forgotpassword
func (*Service) GetConfig ¶
func (service *Service) GetConfig(w http.ResponseWriter, request *http.Request)
func (*Service) GetLoggedInUser ¶
func (service *Service) GetLoggedInUser(request *http.Request, w http.ResponseWriter) (username string, err error)
GetLoggedInUser returns an authenticated user, or an empty string if there is none
func (*Service) GetOauthUser ¶ added in v0.9.11
func (service *Service) GetOauthUser(r *http.Request, w http.ResponseWriter) (username string, err error)
GetOauthUser returns the user in an oauth session, or an empty string if there is none
func (*Service) GetOrganizationInvitation ¶
func (service *Service) GetOrganizationInvitation(w http.ResponseWriter, request *http.Request)
func (*Service) GetSession ¶
func (service *Service) GetSession(request *http.Request, kind SessionType, name string) (*sessions.Session, error)
GetSession returns the a session of the specified kind and a specific name
func (*Service) GetSmsCode ¶
func (service *Service) GetSmsCode(w http.ResponseWriter, request *http.Request)
GetSmsCode returns an sms code for a specified phone label
func (*Service) GetTwoFactorAuthenticationMethods ¶
func (service *Service) GetTwoFactorAuthenticationMethods(w http.ResponseWriter, request *http.Request)
GetTwoFactorAuthenticationMethods returns the possible two factor authentication methods the user can use to login with.
func (*Service) GithubCallback ¶
func (service *Service) GithubCallback(w http.ResponseWriter, request *http.Request)
func (*Service) HomePage ¶
func (service *Service) HomePage(w http.ResponseWriter, request *http.Request)
HomePage shows the home page when logged in, if not, delegate to showing the public website
func (*Service) InitModels ¶
func (service *Service) InitModels()
InitModels initialize persistance models
func (*Service) LoginResendPhonenumberConfirmation ¶
func (service *Service) LoginResendPhonenumberConfirmation(w http.ResponseWriter, request *http.Request)
LoginResendPhonenumberConfirmation resend the phone number confirmation after logging in to a possibly new phone number
func (*Service) Logout ¶
func (service *Service) Logout(w http.ResponseWriter, request *http.Request)
Logout logs out the user and redirect to the homepage TODO: csrf protection, really important here!
func (*Service) MobileSMSConfirmation ¶
func (service *Service) MobileSMSConfirmation(w http.ResponseWriter, request *http.Request)
MobileSMSConfirmation is the page that is linked to in the SMS and is thus accessed on the mobile phone
func (*Service) PhonenumberRegistrationValidation ¶ added in v1.0.0
func (service *Service) PhonenumberRegistrationValidation(w http.ResponseWriter, r *http.Request)
PhonenumberRegistrationValidation handles the sms link in the registration flow
func (*Service) PhonenumberValidation ¶
func (service *Service) PhonenumberValidation(w http.ResponseWriter, request *http.Request)
PhonenumberValidation is the page that is linked to in the SMS for phonenumbervalidation and is thus accessed on the mobile phone
func (*Service) PhonenumberValidationAndLogin ¶ added in v0.9.11
func (service *Service) PhonenumberValidationAndLogin(w http.ResponseWriter, request *http.Request)
PhonenumberValidationAndLogin is the page that is linked to in the SMS for phonenumbervalidation and login. Therefore it is accessed on the mobile phone
func (*Service) Process2FASMSConfirmation ¶
func (service *Service) Process2FASMSConfirmation(w http.ResponseWriter, request *http.Request)
Process2FASMSConfirmation checks the totp 2 factor authentication code
func (*Service) ProcessLoginForm ¶
func (service *Service) ProcessLoginForm(w http.ResponseWriter, request *http.Request)
ProcessLoginForm logs a user in if the credentials are valid
func (*Service) ProcessPhonenumberConfirmationForm ¶
func (service *Service) ProcessPhonenumberConfirmationForm(w http.ResponseWriter, r *http.Request)
ProcessPhonenumberConfirmationForm processes the Phone number confirmation form
func (*Service) ProcessRegistrationForm ¶
func (service *Service) ProcessRegistrationForm(w http.ResponseWriter, r *http.Request)
ProcessRegistrationForm processes the user registration form
func (*Service) ProcessTOTPConfirmation ¶
func (service *Service) ProcessTOTPConfirmation(w http.ResponseWriter, request *http.Request)
ProcessTOTPConfirmation checks the totp 2 factor authentication code
func (*Service) ResendValidationInfo ¶ added in v0.9.15
func (service *Service) ResendValidationInfo(w http.ResponseWriter, r *http.Request)
ResendValidationInfo resends validation info for either the phone number or email address
func (*Service) ResetPassword ¶
func (service *Service) ResetPassword(w http.ResponseWriter, request *http.Request)
ResetPassword handler for POST /login/resetpassword
func (*Service) ServeForgetAccountPage ¶ added in v0.9.16
func (service *Service) ServeForgetAccountPage(w http.ResponseWriter, r *http.Request)
ServeForgetAccountPage serves the forget account page
func (*Service) SetAPIAccessToken ¶
func (service *Service) SetAPIAccessToken(w http.ResponseWriter, token string) (err error)
SetAPIAccessToken sets the api access token in a cookie TODO: is not safe to do. Now there are also two ways of passing tokens to the client
func (*Service) SetLoggedInOauthUser ¶ added in v0.9.11
func (service *Service) SetLoggedInOauthUser(w http.ResponseWriter, r *http.Request, username string) (err error)
SetOauthUser creates a protected session after an oauth flow and clears the login session Also sets the clientID and state
func (*Service) SetLoggedInUser ¶
func (service *Service) SetLoggedInUser(w http.ResponseWriter, request *http.Request, username string) (err error)
SetLoggedInUser creates a session for an authenticated user and clears the login session
func (*Service) SetWebUserMiddleWare ¶
SetWebUserMiddleWare puthe the authenticated user on the context
func (*Service) ShowAuthorizeForm ¶
func (service *Service) ShowAuthorizeForm(w http.ResponseWriter, r *http.Request)
ShowAuthorizeForm shows the scopes an application requested and asks a user for confirmation
func (*Service) ShowLoginForm ¶
func (service *Service) ShowLoginForm(w http.ResponseWriter, request *http.Request)
ShowLoginForm shows the user login page on the initial request
func (*Service) ShowPublicSite ¶
func (service *Service) ShowPublicSite(w http.ResponseWriter, request *http.Request)
ShowPublicSite shows the public website
func (*Service) ShowRegistrationForm ¶
func (service *Service) ShowRegistrationForm(w http.ResponseWriter, request *http.Request)
ShowRegistrationForm shows the user registration page
func (*Service) ValidateEmail ¶ added in v0.9.14
func (service *Service) ValidateEmail(w http.ResponseWriter, r *http.Request)
ValidateEmail is the handler for POST /login/validateemail
func (*Service) ValidateInfo ¶ added in v0.9.15
func (service *Service) ValidateInfo(w http.ResponseWriter, r *http.Request)
ValidateInfo starts validation for a temporary username
type SessionType ¶
type SessionType int
SessionType is used to define the type of session
const ( //SessionForRegistration is the short anynymous session used during registration SessionForRegistration SessionType = iota //SessionInteractive is the session of an authenticated user on the itsyou.online website SessionInteractive SessionType = iota //SessionLogin is the session during the login flow SessionLogin SessionType = iota //SessionOauth is the session during an oauth flow SessionOauth SessionType = iota )