yesod-0.5.3: Creation of type-safe, RESTful web applications.

Yesod.Helpers.Auth

Contents

Synopsis

Subsite

data Auth Source

Constructors

Auth 

Instances

YesodAuth master => YesodSubSite Auth master 

Settings

class (Yesod master, PersistEntity (AuthEntity master), PersistEntity (AuthEmailEntity master)) => YesodAuth master whereSource

Associated Types

type AuthEntity master Source

type AuthEmailEntity master Source

Methods

defaultDest :: master -> Route masterSource

Default destination on successful login or logout, if no other destination exists.

getAuthId :: Creds master -> [(String, String)] -> GHandler s master (Maybe (AuthId master))Source

randomKey :: master -> IO StringSource

Generate a random alphanumeric string.

This is used for verify string in email authentication.

openIdEnabled :: master -> BoolSource

rpxnowSettings :: master -> Maybe RpxnowSettingsSource

emailSettings :: master -> Maybe (EmailSettings master)Source

facebookSettings :: master -> Maybe FacebookSettingsSource

client id, secret and requested permissions

data Creds m Source

User credentials

Constructors

Creds 

Fields

credsIdent :: String

Identifier. Exact meaning depends on credsAuthType.

credsAuthType :: AuthType

How the user was authenticated

credsEmail :: Maybe String

Verified e-mail address.

credsDisplayName :: Maybe String

Display name.

credsId :: Maybe (AuthId m)

Numeric ID, if used.

credsFacebookToken :: Maybe AccessToken
 

data EmailCreds m Source

Data stored in a database for each e-mail address.

Constructors

EmailCreds 

Fields

emailCredsId :: AuthEmailId m
 
emailCredsAuthId :: Maybe (AuthId m)
 
emailCredsStatus :: VerStatus
 
emailCredsVerkey :: Maybe VerKey
 

data AuthType Source

Which subsystem authenticated the user.

data EmailSettings m Source

Constructors

EmailSettings 

Fields

addUnverified :: Email -> VerKey -> GHandler Auth m (AuthEmailId m)
 
sendVerifyEmail :: Email -> VerKey -> VerUrl -> GHandler Auth m ()
 
getVerifyKey :: AuthEmailId m -> GHandler Auth m (Maybe VerKey)
 
setVerifyKey :: AuthEmailId m -> VerKey -> GHandler Auth m ()
 
verifyAccount :: AuthEmailId m -> GHandler Auth m (Maybe (AuthId m))
 
getPassword :: AuthId m -> GHandler Auth m (Maybe SaltedPass)
 
setPassword :: AuthId m -> SaltedPass -> GHandler Auth m ()
 
getEmailCreds :: Email -> GHandler Auth m (Maybe (EmailCreds m))
 
getEmail :: AuthEmailId m -> GHandler Auth m (Maybe Email)
 

Functions

maybeAuthId :: YesodAuth m => GHandler s m (Maybe (AuthId m))Source

Retrieves user credentials, if user is authenticated.

requireAuthId :: YesodAuth m => GHandler sub m (AuthId m)Source

Retrieve user credentials. If user is not logged in, redirects to the authRoute. Sets ultimate destination to current route, so user should be sent back here after authenticating.