Added documentation for Kerberos module
This commit is contained in:
parent
4589a7b08e
commit
0c1dde8209
@ -2,6 +2,22 @@
|
|||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
-- | In-built kerberos authentication for Yesod.
|
||||||
|
--
|
||||||
|
-- Please note that all configuration should have been done
|
||||||
|
-- manually on the machine prior to running the code.
|
||||||
|
--
|
||||||
|
-- On linux machines the configuration might be in /etc/krb5.conf.
|
||||||
|
-- It's worth checking if the Kerberos service provider (e.g. your university)
|
||||||
|
-- already provide a complete configuration file.
|
||||||
|
--
|
||||||
|
-- Be certain that you can manually login from a shell by typing
|
||||||
|
--
|
||||||
|
-- > kinit username
|
||||||
|
--
|
||||||
|
-- If you fill in your password and the program returns no error code,
|
||||||
|
-- then your kerberos configuration is setup properly.
|
||||||
|
-- Only then can this module be of any use.
|
||||||
module Yesod.Auth.Kerberos
|
module Yesod.Auth.Kerberos
|
||||||
( authKerberos,
|
( authKerberos,
|
||||||
genericAuthKerberos,
|
genericAuthKerberos,
|
||||||
@ -29,9 +45,12 @@ data KerberosConfig = KerberosConfig {
|
|||||||
, identifierModifier :: Text -> Text
|
, identifierModifier :: Text -> Text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- | A configuration where the username the user provides is the one passed
|
||||||
|
-- to both kerberos and yesod
|
||||||
defaultKerberosConfig :: KerberosConfig
|
defaultKerberosConfig :: KerberosConfig
|
||||||
defaultKerberosConfig = KerberosConfig id id
|
defaultKerberosConfig = KerberosConfig id id
|
||||||
|
|
||||||
|
-- | A configurable version of 'authKerberos'
|
||||||
genericAuthKerberos :: YesodAuth m => KerberosConfig -> AuthPlugin m
|
genericAuthKerberos :: YesodAuth m => KerberosConfig -> AuthPlugin m
|
||||||
genericAuthKerberos config = AuthPlugin "kerberos" dispatch $ \tm -> addHamlet
|
genericAuthKerberos config = AuthPlugin "kerberos" dispatch $ \tm -> addHamlet
|
||||||
[hamlet|
|
[hamlet|
|
||||||
@ -66,6 +85,7 @@ genericAuthKerberos config = AuthPlugin "kerberos" dispatch $ \tm -> addHamlet
|
|||||||
login :: AuthRoute
|
login :: AuthRoute
|
||||||
login = PluginR "kerberos" ["login"]
|
login = PluginR "kerberos" ["login"]
|
||||||
|
|
||||||
|
-- | Kerberos with 'defaultKerberosConfig'
|
||||||
authKerberos :: YesodAuth m => AuthPlugin m
|
authKerberos :: YesodAuth m => AuthPlugin m
|
||||||
authKerberos = genericAuthKerberos defaultKerberosConfig
|
authKerberos = genericAuthKerberos defaultKerberosConfig
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user