Safe Haskell | None |
---|
- data Auth
- type AuthRoute = Route Auth
- data family Route a1
- data AuthPlugin m = AuthPlugin {}
- getAuth :: a -> Auth
- class (Yesod m, PathPiece (AuthId m), RenderMessage m FormMessage) => YesodAuth m where
- type AuthId m
- loginDest :: m -> Route m
- logoutDest :: m -> Route m
- getAuthId :: Creds m -> GHandler s m (Maybe (AuthId m))
- authPlugins :: m -> [AuthPlugin m]
- loginHandler :: GHandler Auth m RepHtml
- renderAuthMessage :: m -> [Text] -> AuthMessage -> Text
- redirectToReferer :: m -> Bool
- authHttpManager :: m -> Manager
- onLogin :: GHandler s m ()
- onLogout :: GHandler s m ()
- maybeAuthId :: GHandler s m (Maybe (AuthId m))
- data Creds m = Creds {
- credsPlugin :: Text
- credsIdent :: Text
- credsExtra :: [(Text, Text)]
- setCreds :: YesodAuth m => Bool -> Creds m -> GHandler s m ()
- defaultMaybeAuthId :: YesodAuth m => GHandler s m (Maybe (AuthId m))
- maybeAuth :: (YesodAuth m, PersistMonadBackend (b (GHandler s m)) ~ PersistEntityBackend val, b ~ YesodPersistBackend m, Key val ~ AuthId m, PersistStore (b (GHandler s m)), PersistEntity val, YesodPersist m) => GHandler s m (Maybe (Entity val))
- requireAuthId :: YesodAuth m => GHandler s m (AuthId m)
- requireAuth :: (YesodAuth m, b ~ YesodPersistBackend m, PersistMonadBackend (b (GHandler s m)) ~ PersistEntityBackend val, Key val ~ AuthId m, PersistStore (b (GHandler s m)), PersistEntity val, YesodPersist m) => GHandler s m (Entity val)
- data AuthException
Subsite
data family Route a1
The type-safe URLs associated with a site argument.
data AuthPlugin m Source
class (Yesod m, PathPiece (AuthId m), RenderMessage m FormMessage) => YesodAuth m whereSource
loginDest :: m -> Route mSource
Default destination on successful login, if no other destination exists.
logoutDest :: m -> Route mSource
Default destination on successful logout, if no other destination exists.
getAuthId :: Creds m -> GHandler s m (Maybe (AuthId m))Source
Determine the ID associated with the set of credentials.
authPlugins :: m -> [AuthPlugin m]Source
Which authentication backends to use.
loginHandler :: GHandler Auth m RepHtmlSource
What to show on the login page.
:: m | |
-> [Text] | languages |
-> AuthMessage | |
-> Text |
Used for i18n of messages provided by this package.
redirectToReferer :: m -> BoolSource
After login and logout, redirect to the referring page, instead of
loginDest
and logoutDest
. Default is False
.
authHttpManager :: m -> ManagerSource
onLogin :: GHandler s m ()Source
Called on a successful login. By default, calls
setMessageI NowLoggedIn
.
onLogout :: GHandler s m ()Source
Called on logout. By default, does nothing
maybeAuthId :: GHandler s m (Maybe (AuthId m))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 | |
|
setCreds :: YesodAuth m => Bool -> Creds m -> GHandler s m ()Source
FIXME: won't show up till redirect
User functions
defaultMaybeAuthId :: YesodAuth m => GHandler s m (Maybe (AuthId m))Source
Retrieves user credentials from the session, if user is authenticated.
Since 1.1.2
maybeAuth :: (YesodAuth m, PersistMonadBackend (b (GHandler s m)) ~ PersistEntityBackend val, b ~ YesodPersistBackend m, Key val ~ AuthId m, PersistStore (b (GHandler s m)), PersistEntity val, YesodPersist m) => GHandler s m (Maybe (Entity val))Source
requireAuthId :: YesodAuth m => GHandler s m (AuthId m)Source
requireAuth :: (YesodAuth m, b ~ YesodPersistBackend m, PersistMonadBackend (b (GHandler s m)) ~ PersistEntityBackend val, Key val ~ AuthId m, PersistStore (b (GHandler s m)), PersistEntity val, YesodPersist m) => GHandler s m (Entity val)Source