Documentation ¶
Overview ¶
Package auth provides register and login handlers
Index ¶
- Constants
- func AppRedirection(inst *instance.Instance, redirect string) (*url.URL, error)
- func CheckLinkedAppInstalled(inst *instance.Instance, slug string) error
- func ConfirmSuccess(c echo.Context, inst *instance.Instance, state string) error
- func CreateSessionCode(c echo.Context) error
- func DiskInfo(fs vfs.VFS) (string, string, error)
- func GetLinkedApp(instance *instance.Instance, softwareID string) (*app.WebappManifest, error)
- func Home(c echo.Context) error
- func LockOAuthClient(inst *instance.Instance, clientID string) func()
- func LoginRateExceeded(i *instance.Instance) error
- func ReturnSessionCode(c echo.Context, statusCode int, inst *instance.Instance) error
- func Routes(router *echo.Group)
- func SetCookieForNewSession(c echo.Context, duration session.Duration) (string, error)
- func TwoFactorGenerationExceeded(i *instance.Instance) error
- func TwoFactorRateExceeded(i *instance.Instance) error
- type AccessTokenReponse
- type AuthorizeHTTPHandler
- type DeprecatedAppList
- type Store
Constants ¶
const ( // CredentialsErrorKey is the key for translating the message showed to the // user when he/she enters incorrect credentials CredentialsErrorKey = "Login Credentials error" // TwoFactorErrorKey is the key for translating the message showed to the // user when he/she enters incorrect two factor secret TwoFactorErrorKey = "Login Two factor error" // TwoFactorExceededErrorKey is the key for translating the message showed to the // user when there were too many attempts TwoFactorExceededErrorKey = "Login Two factor attempts error" )
const DefaultStoreURL = "https://cozy.io/fr/download/"
Variables ¶
This section is empty.
Functions ¶
func AppRedirection ¶
func CheckLinkedAppInstalled ¶
CheckLinkedAppInstalled checks if a linked webapp has been installed to the instance
func ConfirmSuccess ¶
ConfirmSuccess can be used to send a response after a successful identity confirmation.
func CreateSessionCode ¶
func CreateSessionCode(c echo.Context) error
CreateSessionCode is the handler for creating a session code by the flagship app.
func GetLinkedApp ¶
GetLinkedApp fetches the app manifest on the registry
func Home ¶
func Home(c echo.Context) error
Home is the handler for / It redirects to the login page is the user is not yet authentified Else, it redirects to its home application (or onboarding)
func LockOAuthClient ¶
func LoginRateExceeded ¶
LoginRateExceeded blocks the instance after too many failed attempts to login
func ReturnSessionCode ¶
func SetCookieForNewSession ¶
SetCookieForNewSession creates a new session and sets the cookie on echo context
func TwoFactorGenerationExceeded ¶
TwoFactorGenerationExceeded checks if there was too many attempts to regenerate a 2FA code within an hour
func TwoFactorRateExceeded ¶
TwoFactorRateExceeded regenerates a new 2FA passcode after too many failed attempts to login
Types ¶
type AccessTokenReponse ¶
type AccessTokenReponse struct { Type string `json:"token_type"` Scope string `json:"scope"` Access string `json:"access_token"` Refresh string `json:"refresh_token,omitempty"` }
AccessTokenReponse is the stuct used for serializing to JSON the response for an access token.
type AuthorizeHTTPHandler ¶
type AuthorizeHTTPHandler struct {
// contains filtered or unexported fields
}
func NewAuthorizeHandler ¶
func NewAuthorizeHandler(deprecatedAppsCfg config.DeprecatedAppsCfg) *AuthorizeHTTPHandler
NewAuthorizeHandler instantiates a new [AuthHTTPHandler].
func (*AuthorizeHTTPHandler) Register ¶
func (a *AuthorizeHTTPHandler) Register(router *echo.Group)
type DeprecatedAppList ¶
type DeprecatedAppList struct {
// contains filtered or unexported fields
}
DeprecatedAppList lists and detects the deprecated apps.
func NewDeprecatedAppList ¶
func NewDeprecatedAppList(cfg config.DeprecatedAppsCfg) *DeprecatedAppList
NewDeprecatedAppList instantiates a new DeprecatedAppList.
func (*DeprecatedAppList) IsDeprecated ¶
func (d *DeprecatedAppList) IsDeprecated(client *oauth.Client) bool
IsDeprecated returns true if the given client is marked as deprectated.