- data Auth = Auth
- getAuth :: a -> Auth
- data AuthRoute
- = CheckR
- | LogoutR
- | OpenIdForwardR
- | OpenIdCompleteR
- | RpxnowR
- | FacebookR
- | EmailRegisterR
- | EmailVerifyR Int64 String
- | EmailLoginR
- | EmailPasswordR
- | LoginR
- class (Yesod master, PersistEntity (AuthEntity master), PersistEntity (AuthEmailEntity master)) => YesodAuth master where
- type AuthEntity master
- type AuthEmailEntity master
- defaultDest :: master -> Route master
- getAuthId :: Creds master -> [(String, String)] -> GHandler s master (Maybe (AuthId master))
- randomKey :: master -> IO String
- openIdEnabled :: master -> Bool
- rpxnowSettings :: master -> Maybe RpxnowSettings
- emailSettings :: master -> Maybe (EmailSettings master)
- facebookSettings :: master -> Maybe FacebookSettings
- data Creds m = Creds {
- credsIdent :: String
- credsAuthType :: AuthType
- credsEmail :: Maybe String
- credsDisplayName :: Maybe String
- credsId :: Maybe (AuthId m)
- credsFacebookToken :: Maybe AccessToken
- data EmailCreds m = EmailCreds {
- emailCredsId :: AuthEmailId m
- emailCredsAuthId :: Maybe (AuthId m)
- emailCredsStatus :: VerStatus
- emailCredsVerkey :: Maybe VerKey
- data AuthType
- = AuthOpenId
- | AuthRpxnow
- | AuthEmail
- | AuthFacebook
- data RpxnowSettings = RpxnowSettings {}
- data EmailSettings m = EmailSettings {
- 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)
- data FacebookSettings = FacebookSettings {}
- getFacebookUrl :: YesodAuth m => (AuthRoute -> Route m) -> GHandler s m (Maybe String)
- maybeAuth :: (PersistBackend (YesodDB m (GHandler s m)), YesodPersist m, YesodAuth m) => GHandler s m (Maybe (AuthId m, AuthEntity m))
- maybeAuthId :: YesodAuth m => GHandler s m (Maybe (AuthId m))
- requireAuth :: (PersistBackend (YesodDB m (GHandler s m)), YesodPersist m, YesodAuth m) => GHandler s m (AuthId m, AuthEntity m)
- requireAuthId :: YesodAuth m => GHandler sub m (AuthId m)
Subsite
Settings
class (Yesod master, PersistEntity (AuthEntity master), PersistEntity (AuthEmailEntity master)) => YesodAuth master whereSource
type AuthEntity master Source
type AuthEmailEntity master Source
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
User credentials
Creds | |
|
data EmailCreds m Source
Data stored in a database for each e-mail address.
EmailCreds | |
|
Which subsystem authenticated the user.
data RpxnowSettings Source
data EmailSettings m Source
EmailSettings | |
|
data FacebookSettings Source
Functions
maybeAuth :: (PersistBackend (YesodDB m (GHandler s m)), YesodPersist m, YesodAuth m) => GHandler s m (Maybe (AuthId m, AuthEntity m))Source
maybeAuthId :: YesodAuth m => GHandler s m (Maybe (AuthId m))Source
Retrieves user credentials, if user is authenticated.
requireAuth :: (PersistBackend (YesodDB m (GHandler s m)), YesodPersist m, YesodAuth m) => GHandler s m (AuthId m, AuthEntity m)Source
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.