siteservice

package
v0.0.0-...-d3d53d6 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2016 License: BSD-3-Clause Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
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) (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) AddRoutes

func (service *Service) AddRoutes(router *mux.Router)

AddRoutes registers the http routes with the router

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) CheckRegistrationSMSConfirmation

func (service *Service) CheckRegistrationSMSConfirmation(w http.ResponseWriter, request *http.Request)

CheckRegistrationSMSConfirmation is called by the sms code form to check if the sms is already confirmed on the mobile phone

func (*Service) EmailValidation

func (service *Service) EmailValidation(w http.ResponseWriter, request *http.Request)

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) 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) 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) 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) 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, request *http.Request)

ProcessPhonenumberConfirmationForm processes the Phone number confirmation form

func (*Service) ProcessRegistrationForm

func (service *Service) ProcessRegistrationForm(w http.ResponseWriter, request *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) ResendPhonenumberConfirmation

func (service *Service) ResendPhonenumberConfirmation(w http.ResponseWriter, request *http.Request)

ResendPhonenumberConfirmation resend the phonenumberconfirmation to a possbily new phonenumber

func (*Service) ResetPassword

func (service *Service) ResetPassword(w http.ResponseWriter, request *http.Request)

ResetPassword handler for POST /login/resetpassword

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) 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

func (service *Service) SetWebUserMiddleWare(next http.Handler) http.Handler

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) ValidateUsername

func (service *Service) ValidateUsername(w http.ResponseWriter, request *http.Request)

ValidateUsername checks if a username is already taken or not

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
)

Directories

Path Synopsis
website

Jump to

Keyboard shortcuts

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