Safe Haskell | None |
---|
- data Auth
- type AuthRoute = Route Auth
- data family Route a1
- data AuthPlugin master = AuthPlugin {}
- getAuth :: a -> Auth
- class (Yesod master, PathPiece (AuthId master), RenderMessage master FormMessage) => YesodAuth master where
- type AuthId master
- loginDest :: master -> Route master
- logoutDest :: master -> Route master
- getAuthId :: Creds master -> GHandler sub master (Maybe (AuthId master))
- authPlugins :: master -> [AuthPlugin master]
- loginHandler :: GHandler Auth master RepHtml
- renderAuthMessage :: master -> [Text] -> AuthMessage -> Text
- redirectToReferer :: master -> Bool
- authHttpManager :: master -> Manager
- onLogin :: GHandler sub master ()
- onLogout :: GHandler sub master ()
- maybeAuthId :: GHandler sub master (Maybe (AuthId master))
- data Creds master = Creds {
- credsPlugin :: Text
- credsIdent :: Text
- credsExtra :: [(Text, Text)]
- setCreds :: YesodAuth master => Bool -> Creds master -> GHandler sub master ()
- defaultMaybeAuthId :: YesodAuth master => GHandler sub master (Maybe (AuthId master))
- maybeAuth :: (YesodAuth master, PersistMonadBackend (b (GHandler sub master)) ~ PersistEntityBackend val, b ~ YesodPersistBackend master, Key val ~ AuthId master, PersistStore (b (GHandler sub master)), PersistEntity val, YesodPersist master) => GHandler sub master (Maybe (Entity val))
- requireAuthId :: YesodAuth master => GHandler sub master (AuthId master)
- requireAuth :: (YesodAuth master, b ~ YesodPersistBackend master, PersistMonadBackend (b (GHandler sub master)) ~ PersistEntityBackend val, Key val ~ AuthId master, PersistStore (b (GHandler sub master)), PersistEntity val, YesodPersist master) => GHandler sub master (Entity val)
- data AuthException
Subsite
data family Route a1
The type-safe URLs associated with a site argument.
data AuthPlugin master Source
class (Yesod master, PathPiece (AuthId master), RenderMessage master FormMessage) => YesodAuth master whereSource
loginDest :: master -> Route masterSource
Default destination on successful login, if no other destination exists.
logoutDest :: master -> Route masterSource
Default destination on successful logout, if no other destination exists.
getAuthId :: Creds master -> GHandler sub master (Maybe (AuthId master))Source
Determine the ID associated with the set of credentials.
authPlugins :: master -> [AuthPlugin master]Source
Which authentication backends to use.
loginHandler :: GHandler Auth master RepHtmlSource
What to show on the login page.
:: master | |
-> [Text] | languages |
-> AuthMessage | |
-> Text |
Used for i18n of messages provided by this package.
redirectToReferer :: master -> BoolSource
After login and logout, redirect to the referring page, instead of
loginDest
and logoutDest
. Default is False
.
authHttpManager :: master -> ManagerSource
onLogin :: GHandler sub master ()Source
Called on a successful login. By default, calls
setMessageI NowLoggedIn
.
onLogout :: GHandler sub master ()Source
Called on logout. By default, does nothing
maybeAuthId :: GHandler sub master (Maybe (AuthId master))Source
Retrieves user credentials, if user is authenticated.
By default, this calls defaultMaybeAuthId
to get the user ID from the
session. This can be overridden to allow authentication via other means,
such as checking for a special token in a request header. This is
especially useful for creating an API to be accessed via some means
other than a browser.
Since 1.1.2
Plugin interface
User credentials
Creds | |
|
User functions
defaultMaybeAuthId :: YesodAuth master => GHandler sub master (Maybe (AuthId master))Source
Retrieves user credentials from the session, if user is authenticated.
Since 1.1.2
maybeAuth :: (YesodAuth master, PersistMonadBackend (b (GHandler sub master)) ~ PersistEntityBackend val, b ~ YesodPersistBackend master, Key val ~ AuthId master, PersistStore (b (GHandler sub master)), PersistEntity val, YesodPersist master) => GHandler sub master (Maybe (Entity val))Source
requireAuthId :: YesodAuth master => GHandler sub master (AuthId master)Source
requireAuth :: (YesodAuth master, b ~ YesodPersistBackend master, PersistMonadBackend (b (GHandler sub master)) ~ PersistEntityBackend val, Key val ~ AuthId master, PersistStore (b (GHandler sub master)), PersistEntity val, YesodPersist master) => GHandler sub master (Entity val)Source