Safe Haskell | None |
---|---|
Language | Haskell98 |
Happstack.Authenticate.Core
Synopsis
- data AuthenticateConfig = AuthenticateConfig {
- _isAuthAdmin :: UserId -> IO Bool
- _usernameAcceptable :: Username -> Maybe CoreError
- _requireEmail :: Bool
- isAuthAdmin :: Lens' AuthenticateConfig (UserId -> IO Bool)
- usernameAcceptable :: Lens' AuthenticateConfig (Username -> Maybe CoreError)
- requireEmail :: Lens' AuthenticateConfig Bool
- data HappstackAuthenticateI18N = HappstackAuthenticateI18N
- newtype UserId = UserId {}
- unUserId :: Functor f => (Integer -> f Integer) -> UserId -> f UserId
- rUserId :: Boomerang e tok (Integer :- r) (UserId :- r)
- succUserId :: UserId -> UserId
- jsonOptions :: Options
- toJSONResponse :: (RenderMessage HappstackAuthenticateI18N e, ToJSON a) => Either e a -> Response
- toJSONSuccess :: ToJSON a => a -> Response
- toJSONError :: forall e. RenderMessage HappstackAuthenticateI18N e => e -> Response
- newtype Username = Username {
- _unUsername :: Text
- unUsername :: Iso' Username Text
- rUsername :: forall tok e r. Boomerang e tok ((:-) Text r) ((:-) Username r)
- usernamePolicy :: Username -> Maybe CoreError
- newtype Email = Email {}
- unEmail :: Iso' Email Text
- data User = User {}
- userId :: Lens' User UserId
- username :: Lens' User Username
- email :: Lens' User (Maybe Email)
- type UserIxs = '[UserId, Username, Email]
- type IxUser = IxSet UserIxs User
- newtype SharedSecret = SharedSecret {}
- unSharedSecret :: Iso' SharedSecret Text
- genSharedSecret :: MonadIO m => m SharedSecret
- genSharedSecretDevURandom :: IO SharedSecret
- genSharedSecretSysRandom :: IO SharedSecret
- type SharedSecrets = Map UserId SharedSecret
- initialSharedSecrets :: SharedSecrets
- data CoreError
- data NewAccountMode
- data AuthenticateState = AuthenticateState {}
- sharedSecrets :: Lens' AuthenticateState SharedSecrets
- users :: Lens' AuthenticateState IxUser
- nextUserId :: Lens' AuthenticateState UserId
- defaultSessionTimeout :: Lens' AuthenticateState Int
- newAccountMode :: Lens' AuthenticateState NewAccountMode
- initialAuthenticateState :: AuthenticateState
- data SetSharedSecret = SetSharedSecret UserId SharedSecret
- newtype GetSharedSecret = GetSharedSecret UserId
- newtype SetDefaultSessionTimeout = SetDefaultSessionTimeout Int
- data GetDefaultSessionTimeout = GetDefaultSessionTimeout
- newtype SetNewAccountMode = SetNewAccountMode NewAccountMode
- data GetNewAccountMode = GetNewAccountMode
- newtype CreateUser = CreateUser User
- data CreateAnonymousUser = CreateAnonymousUser
- newtype UpdateUser = UpdateUser User
- newtype DeleteUser = DeleteUser UserId
- newtype GetUserByUsername = GetUserByUsername Username
- newtype GetUserByUserId = GetUserByUserId UserId
- newtype GetUserByEmail = GetUserByEmail Email
- data GetAuthenticateState = GetAuthenticateState
- getOrGenSharedSecret :: MonadIO m => AcidState AuthenticateState -> UserId -> m SharedSecret
- data Token = Token {}
- tokenUser :: Lens' Token User
- tokenIsAuthAdmin :: Lens' Token Bool
- type TokenText = Text
- issueToken :: MonadIO m => AcidState AuthenticateState -> AuthenticateConfig -> User -> m TokenText
- decodeAndVerifyToken :: MonadIO m => AcidState AuthenticateState -> UTCTime -> TokenText -> m (Maybe (Token, JWT VerifiedJWT))
- authCookieName :: String
- addTokenCookie :: Happstack m => AcidState AuthenticateState -> AuthenticateConfig -> User -> m TokenText
- deleteTokenCookie :: Happstack m => m ()
- getTokenCookie :: Happstack m => AcidState AuthenticateState -> m (Maybe (Token, JWT VerifiedJWT))
- getTokenHeader :: Happstack m => AcidState AuthenticateState -> m (Maybe (Token, JWT VerifiedJWT))
- getToken :: Happstack m => AcidState AuthenticateState -> m (Maybe (Token, JWT VerifiedJWT))
- getUserId :: Happstack m => AcidState AuthenticateState -> m (Maybe UserId)
- newtype AuthenticationMethod = AuthenticationMethod {}
- unAuthenticationMethod :: Iso' AuthenticationMethod Text
- rAuthenticationMethod :: forall tok e r. Boomerang e tok ((:-) Text r) ((:-) AuthenticationMethod r)
- type AuthenticationHandler = [Text] -> RouteT AuthenticateURL (ServerPartT IO) Response
- type AuthenticationHandlers = Map AuthenticationMethod AuthenticationHandler
- data AuthenticateURL
- rAuthenticationMethods :: forall tok e r. Boomerang e tok ((:-) (Maybe (AuthenticationMethod, [Text])) r) ((:-) AuthenticateURL r)
- rControllers :: forall tok e r. Boomerang e tok r ((:-) AuthenticateURL r)
- authenticateURL :: Router () (AuthenticateURL :- ())
- nestAuthenticationMethod :: PathInfo methodURL => AuthenticationMethod -> RouteT methodURL m a -> RouteT AuthenticateURL m a
Documentation
data AuthenticateConfig Source #
Various configuration options that apply to all authentication methods
Constructors
AuthenticateConfig | |
Fields
|
Instances
Generic AuthenticateConfig Source # | |
Defined in Happstack.Authenticate.Core Associated Types type Rep AuthenticateConfig :: * -> * # Methods from :: AuthenticateConfig -> Rep AuthenticateConfig x # to :: Rep AuthenticateConfig x -> AuthenticateConfig # | |
type Rep AuthenticateConfig Source # | |
Defined in Happstack.Authenticate.Core type Rep AuthenticateConfig = D1 (MetaData "AuthenticateConfig" "Happstack.Authenticate.Core" "happstack-authenticate-2.3.4.11-Bwj3cHLrT0KCBoc9b6QczY" False) (C1 (MetaCons "AuthenticateConfig" PrefixI True) (S1 (MetaSel (Just "_isAuthAdmin") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (UserId -> IO Bool)) :*: (S1 (MetaSel (Just "_usernameAcceptable") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Username -> Maybe CoreError)) :*: S1 (MetaSel (Just "_requireEmail") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)))) |
isAuthAdmin :: Lens' AuthenticateConfig (UserId -> IO Bool) Source #
data HappstackAuthenticateI18N Source #
Constructors
HappstackAuthenticateI18N |
Instances
RenderMessage HappstackAuthenticateI18N CoreError Source # | |
Defined in Happstack.Authenticate.Core Methods renderMessage :: HappstackAuthenticateI18N -> [Lang] -> CoreError -> Text # | |
RenderMessage HappstackAuthenticateI18N OpenIdError # | |
Defined in Happstack.Authenticate.OpenId.Core Methods renderMessage :: HappstackAuthenticateI18N -> [Lang] -> OpenIdError -> Text # | |
RenderMessage HappstackAuthenticateI18N PartialMsgs # | |
Defined in Happstack.Authenticate.OpenId.Partials Methods renderMessage :: HappstackAuthenticateI18N -> [Lang] -> PartialMsgs -> Text # | |
RenderMessage HappstackAuthenticateI18N PasswordError # | |
Defined in Happstack.Authenticate.Password.Core Methods renderMessage :: HappstackAuthenticateI18N -> [Lang] -> PasswordError -> Text # | |
RenderMessage HappstackAuthenticateI18N PartialMsgs # | |
Defined in Happstack.Authenticate.Password.Partials Methods renderMessage :: HappstackAuthenticateI18N -> [Lang] -> PartialMsgs -> Text # |
a UserId
uniquely identifies a user.
Instances
Enum UserId | |
Defined in Data.UserId | |
Eq UserId | |
Data UserId | |
Defined in Data.UserId Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UserId -> c UserId # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UserId # toConstr :: UserId -> Constr # dataTypeOf :: UserId -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UserId) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UserId) # gmapT :: (forall b. Data b => b -> b) -> UserId -> UserId # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UserId -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UserId -> r # gmapQ :: (forall d. Data d => d -> u) -> UserId -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> UserId -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> UserId -> m UserId # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UserId -> m UserId # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UserId -> m UserId # | |
Ord UserId | |
Read UserId | |
Show UserId | |
Generic UserId | |
ToJSON UserId | |
Defined in Data.UserId | |
FromJSON UserId | |
PathInfo UserId | |
Defined in Data.UserId | |
SafeCopy UserId | |
Defined in Data.UserId Methods getCopy :: Contained (Get UserId) putCopy :: UserId -> Contained Put internalConsistency :: Consistency UserId objectProfile :: Profile UserId errorTypeName :: Proxy UserId -> String | |
Serialize UserId | |
Defined in Data.UserId | |
Indexable UserIxs User | |
Defined in Happstack.Authenticate.Core | |
type Rep UserId | |
Defined in Data.UserId |
succUserId :: UserId -> UserId #
get the next UserId
jsonOptions :: Options Source #
when creating JSON field names, drop the first character. Since we are using lens, the leading character should always be _.
toJSONResponse :: (RenderMessage HappstackAuthenticateI18N e, ToJSON a) => Either e a -> Response Source #
convert a value to a JSON encoded Response
toJSONError :: forall e. RenderMessage HappstackAuthenticateI18N e => e -> Response Source #
convert an error to a JSON encoded Response
FIXME: I18N
an arbitrary, but unique string that the user uses to identify themselves
Constructors
Username | |
Fields
|
Instances
Eq Username Source # | |
Data Username Source # | |
Defined in Happstack.Authenticate.Core Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Username -> c Username # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Username # toConstr :: Username -> Constr # dataTypeOf :: Username -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Username) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Username) # gmapT :: (forall b. Data b => b -> b) -> Username -> Username # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Username -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Username -> r # gmapQ :: (forall d. Data d => d -> u) -> Username -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Username -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Username -> m Username # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Username -> m Username # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Username -> m Username # | |
Ord Username Source # | |
Defined in Happstack.Authenticate.Core | |
Read Username Source # | |
Show Username Source # | |
Generic Username Source # | |
ToJSON Username Source # | |
Defined in Happstack.Authenticate.Core | |
FromJSON Username Source # | |
PathInfo Username Source # | |
Defined in Happstack.Authenticate.Core | |
SafeCopy Username Source # | |
Defined in Happstack.Authenticate.Core Methods getCopy :: Contained (Get Username) putCopy :: Username -> Contained Put internalConsistency :: Consistency Username objectProfile :: Profile Username errorTypeName :: Proxy Username -> String | |
Indexable UserIxs User Source # | |
Defined in Happstack.Authenticate.Core | |
type Rep Username Source # | |
Defined in Happstack.Authenticate.Core |
an Email
address. No validation in performed.
Instances
Eq Email Source # | |
Data Email Source # | |
Defined in Happstack.Authenticate.Core Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Email -> c Email # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Email # dataTypeOf :: Email -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Email) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Email) # gmapT :: (forall b. Data b => b -> b) -> Email -> Email # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Email -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Email -> r # gmapQ :: (forall d. Data d => d -> u) -> Email -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Email -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Email -> m Email # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Email -> m Email # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Email -> m Email # | |
Ord Email Source # | |
Read Email Source # | |
Show Email Source # | |
Generic Email Source # | |
ToJSON Email Source # | |
Defined in Happstack.Authenticate.Core | |
FromJSON Email Source # | |
PathInfo Email Source # | |
Defined in Happstack.Authenticate.Core | |
SafeCopy Email Source # | |
Defined in Happstack.Authenticate.Core Methods getCopy :: Contained (Get Email) putCopy :: Email -> Contained Put internalConsistency :: Consistency Email objectProfile :: Profile Email errorTypeName :: Proxy Email -> String | |
Indexable UserIxs User Source # | |
Defined in Happstack.Authenticate.Core | |
type Rep Email Source # | |
Defined in Happstack.Authenticate.Core |
A unique User
Instances
Eq User Source # | |
Data User Source # | |
Defined in Happstack.Authenticate.Core Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> User -> c User # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c User # dataTypeOf :: User -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c User) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c User) # gmapT :: (forall b. Data b => b -> b) -> User -> User # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> User -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> User -> r # gmapQ :: (forall d. Data d => d -> u) -> User -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> User -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> User -> m User # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> User -> m User # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> User -> m User # | |
Ord User Source # | |
Read User Source # | |
Show User Source # | |
Generic User Source # | |
ToJSON User Source # | |
Defined in Happstack.Authenticate.Core | |
FromJSON User Source # | |
SafeCopy User Source # | |
Defined in Happstack.Authenticate.Core Methods getCopy :: Contained (Get User) putCopy :: User -> Contained Put internalConsistency :: Consistency User objectProfile :: Profile User errorTypeName :: Proxy User -> String | |
Indexable UserIxs User Source # | |
Defined in Happstack.Authenticate.Core | |
type Rep User Source # | |
Defined in Happstack.Authenticate.Core type Rep User = D1 (MetaData "User" "Happstack.Authenticate.Core" "happstack-authenticate-2.3.4.11-Bwj3cHLrT0KCBoc9b6QczY" False) (C1 (MetaCons "User" PrefixI True) (S1 (MetaSel (Just "_userId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 UserId) :*: (S1 (MetaSel (Just "_username") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Username) :*: S1 (MetaSel (Just "_email") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Email))))) |
newtype SharedSecret Source #
The shared secret is used to encrypt a users data on a per-user basis. We can invalidate a JWT value by changing the shared secret.
Constructors
SharedSecret | |
Fields |
genSharedSecret :: MonadIO m => m SharedSecret Source #
Generate a Salt
from 128 bits of data from /dev/urandom
, with the
system RNG as a fallback. This is the function used to generate salts by
makePassword
.
genSharedSecretDevURandom :: IO SharedSecret Source #
Generate a SharedSecret
from /dev/urandom
.
see: genSharedSecret
genSharedSecretSysRandom :: IO SharedSecret Source #
Generate a SharedSecret
from Random
.
see: genSharedSecret
type SharedSecrets = Map UserId SharedSecret Source #
A map which stores the SharedSecret
for each UserId
initialSharedSecrets :: SharedSecrets Source #
An empty SharedSecrets
the CoreError
type is used to represent errors in a language
agnostic manner. The errors are translated into human readable form
via the I18N translations.
Constructors
HandlerNotFound | |
URLDecodeFailed | |
UsernameAlreadyExists | |
AuthorizationRequired | |
Forbidden | |
JSONDecodeFailed | |
InvalidUserId | |
UsernameNotAcceptable | |
InvalidEmail | |
TextError Text |
Instances
Eq CoreError Source # | |
Data CoreError Source # | |
Defined in Happstack.Authenticate.Core Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CoreError -> c CoreError # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CoreError # toConstr :: CoreError -> Constr # dataTypeOf :: CoreError -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CoreError) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CoreError) # gmapT :: (forall b. Data b => b -> b) -> CoreError -> CoreError # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CoreError -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CoreError -> r # gmapQ :: (forall d. Data d => d -> u) -> CoreError -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> CoreError -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CoreError -> m CoreError # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CoreError -> m CoreError # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CoreError -> m CoreError # | |
Ord CoreError Source # | |
Read CoreError Source # | |
Show CoreError Source # | |
Generic CoreError Source # | |
ToJSON CoreError Source # | |
Defined in Happstack.Authenticate.Core | |
FromJSON CoreError Source # | |
ToJExpr CoreError Source # | |
Defined in Happstack.Authenticate.Core | |
SafeCopy CoreError Source # | |
Defined in Happstack.Authenticate.Core Methods getCopy :: Contained (Get CoreError) putCopy :: CoreError -> Contained Put internalConsistency :: Consistency CoreError objectProfile :: Profile CoreError errorTypeName :: Proxy CoreError -> String | |
RenderMessage HappstackAuthenticateI18N CoreError Source # | |
Defined in Happstack.Authenticate.Core Methods renderMessage :: HappstackAuthenticateI18N -> [Lang] -> CoreError -> Text # | |
type Rep CoreError Source # | |
Defined in Happstack.Authenticate.Core type Rep CoreError = D1 (MetaData "CoreError" "Happstack.Authenticate.Core" "happstack-authenticate-2.3.4.11-Bwj3cHLrT0KCBoc9b6QczY" False) (((C1 (MetaCons "HandlerNotFound" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "URLDecodeFailed" PrefixI False) (U1 :: * -> *)) :+: (C1 (MetaCons "UsernameAlreadyExists" PrefixI False) (U1 :: * -> *) :+: (C1 (MetaCons "AuthorizationRequired" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "Forbidden" PrefixI False) (U1 :: * -> *)))) :+: ((C1 (MetaCons "JSONDecodeFailed" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "InvalidUserId" PrefixI False) (U1 :: * -> *)) :+: (C1 (MetaCons "UsernameNotAcceptable" PrefixI False) (U1 :: * -> *) :+: (C1 (MetaCons "InvalidEmail" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "TextError" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))))) |
data NewAccountMode Source #
This value is used to configure the type of new user registrations permitted for this system.
Constructors
OpenRegistration | new users can create their own accounts |
ModeratedRegistration | new users can apply to create their own accounts, but a moderator must approve them before they are active |
ClosedRegistration | only the admin can create a new account |
Instances
data AuthenticateState Source #
this acid-state value contains the state common to all authentication methods
Constructors
AuthenticateState | |
Fields
|
Instances
initialAuthenticateState :: AuthenticateState Source #
a reasonable initial AuthenticateState
newtype SetDefaultSessionTimeout Source #
Constructors
SetDefaultSessionTimeout Int |
Instances
UpdateEvent SetDefaultSessionTimeout Source # | |
Defined in Happstack.Authenticate.Core | |
Method SetDefaultSessionTimeout Source # | |
Defined in Happstack.Authenticate.Core Associated Types type MethodResult SetDefaultSessionTimeout :: * type MethodState SetDefaultSessionTimeout :: * Methods methodTag :: SetDefaultSessionTimeout -> Tag | |
SafeCopy SetDefaultSessionTimeout Source # | |
Defined in Happstack.Authenticate.Core Methods version :: Version SetDefaultSessionTimeout kind :: Kind SetDefaultSessionTimeout getCopy :: Contained (Get SetDefaultSessionTimeout) putCopy :: SetDefaultSessionTimeout -> Contained Put internalConsistency :: Consistency SetDefaultSessionTimeout objectProfile :: Profile SetDefaultSessionTimeout errorTypeName :: Proxy SetDefaultSessionTimeout -> String | |
type MethodResult SetDefaultSessionTimeout Source # | |
Defined in Happstack.Authenticate.Core type MethodResult SetDefaultSessionTimeout = () | |
type MethodState SetDefaultSessionTimeout Source # | |
Defined in Happstack.Authenticate.Core |
data GetDefaultSessionTimeout Source #
Constructors
GetDefaultSessionTimeout |
Instances
QueryEvent GetDefaultSessionTimeout Source # | |
Defined in Happstack.Authenticate.Core | |
Method GetDefaultSessionTimeout Source # | |
Defined in Happstack.Authenticate.Core Associated Types type MethodResult GetDefaultSessionTimeout :: * type MethodState GetDefaultSessionTimeout :: * Methods methodTag :: GetDefaultSessionTimeout -> Tag | |
SafeCopy GetDefaultSessionTimeout Source # | |
Defined in Happstack.Authenticate.Core Methods version :: Version GetDefaultSessionTimeout kind :: Kind GetDefaultSessionTimeout getCopy :: Contained (Get GetDefaultSessionTimeout) putCopy :: GetDefaultSessionTimeout -> Contained Put internalConsistency :: Consistency GetDefaultSessionTimeout objectProfile :: Profile GetDefaultSessionTimeout errorTypeName :: Proxy GetDefaultSessionTimeout -> String | |
type MethodResult GetDefaultSessionTimeout Source # | |
Defined in Happstack.Authenticate.Core | |
type MethodState GetDefaultSessionTimeout Source # | |
Defined in Happstack.Authenticate.Core |
newtype SetNewAccountMode Source #
Constructors
SetNewAccountMode NewAccountMode |
Instances
UpdateEvent SetNewAccountMode Source # | |
Defined in Happstack.Authenticate.Core | |
Method SetNewAccountMode Source # | |
Defined in Happstack.Authenticate.Core Methods methodTag :: SetNewAccountMode -> Tag | |
SafeCopy SetNewAccountMode Source # | |
Defined in Happstack.Authenticate.Core Methods version :: Version SetNewAccountMode kind :: Kind SetNewAccountMode getCopy :: Contained (Get SetNewAccountMode) putCopy :: SetNewAccountMode -> Contained Put internalConsistency :: Consistency SetNewAccountMode objectProfile :: Profile SetNewAccountMode errorTypeName :: Proxy SetNewAccountMode -> String | |
type MethodResult SetNewAccountMode Source # | |
Defined in Happstack.Authenticate.Core type MethodResult SetNewAccountMode = () | |
type MethodState SetNewAccountMode Source # | |
Defined in Happstack.Authenticate.Core |
data GetNewAccountMode Source #
Constructors
GetNewAccountMode |
Instances
QueryEvent GetNewAccountMode Source # | |
Defined in Happstack.Authenticate.Core | |
Method GetNewAccountMode Source # | |
Defined in Happstack.Authenticate.Core Methods methodTag :: GetNewAccountMode -> Tag | |
SafeCopy GetNewAccountMode Source # | |
Defined in Happstack.Authenticate.Core Methods version :: Version GetNewAccountMode kind :: Kind GetNewAccountMode getCopy :: Contained (Get GetNewAccountMode) putCopy :: GetNewAccountMode -> Contained Put internalConsistency :: Consistency GetNewAccountMode objectProfile :: Profile GetNewAccountMode errorTypeName :: Proxy GetNewAccountMode -> String | |
type MethodResult GetNewAccountMode Source # | |
Defined in Happstack.Authenticate.Core | |
type MethodState GetNewAccountMode Source # | |
Defined in Happstack.Authenticate.Core |
newtype CreateUser Source #
Constructors
CreateUser User |
Instances
UpdateEvent CreateUser Source # | |
Defined in Happstack.Authenticate.Core | |
Method CreateUser Source # | |
Defined in Happstack.Authenticate.Core Methods methodTag :: CreateUser -> Tag | |
SafeCopy CreateUser Source # | |
Defined in Happstack.Authenticate.Core Methods version :: Version CreateUser kind :: Kind CreateUser getCopy :: Contained (Get CreateUser) putCopy :: CreateUser -> Contained Put internalConsistency :: Consistency CreateUser objectProfile :: Profile CreateUser errorTypeName :: Proxy CreateUser -> String | |
type MethodResult CreateUser Source # | |
Defined in Happstack.Authenticate.Core | |
type MethodState CreateUser Source # | |
Defined in Happstack.Authenticate.Core |
data CreateAnonymousUser Source #
Constructors
CreateAnonymousUser |
Instances
UpdateEvent CreateAnonymousUser Source # | |
Defined in Happstack.Authenticate.Core | |
Method CreateAnonymousUser Source # | |
Defined in Happstack.Authenticate.Core Methods methodTag :: CreateAnonymousUser -> Tag | |
SafeCopy CreateAnonymousUser Source # | |
Defined in Happstack.Authenticate.Core Methods version :: Version CreateAnonymousUser kind :: Kind CreateAnonymousUser getCopy :: Contained (Get CreateAnonymousUser) putCopy :: CreateAnonymousUser -> Contained Put internalConsistency :: Consistency CreateAnonymousUser objectProfile :: Profile CreateAnonymousUser errorTypeName :: Proxy CreateAnonymousUser -> String | |
type MethodResult CreateAnonymousUser Source # | |
Defined in Happstack.Authenticate.Core | |
type MethodState CreateAnonymousUser Source # | |
Defined in Happstack.Authenticate.Core |
newtype UpdateUser Source #
Constructors
UpdateUser User |
Instances
UpdateEvent UpdateUser Source # | |
Defined in Happstack.Authenticate.Core | |
Method UpdateUser Source # | |
Defined in Happstack.Authenticate.Core Methods methodTag :: UpdateUser -> Tag | |
SafeCopy UpdateUser Source # | |
Defined in Happstack.Authenticate.Core Methods version :: Version UpdateUser kind :: Kind UpdateUser getCopy :: Contained (Get UpdateUser) putCopy :: UpdateUser -> Contained Put internalConsistency :: Consistency UpdateUser objectProfile :: Profile UpdateUser errorTypeName :: Proxy UpdateUser -> String | |
type MethodResult UpdateUser Source # | |
Defined in Happstack.Authenticate.Core type MethodResult UpdateUser = () | |
type MethodState UpdateUser Source # | |
Defined in Happstack.Authenticate.Core |
newtype DeleteUser Source #
Constructors
DeleteUser UserId |
Instances
UpdateEvent DeleteUser Source # | |
Defined in Happstack.Authenticate.Core | |
Method DeleteUser Source # | |
Defined in Happstack.Authenticate.Core Methods methodTag :: DeleteUser -> Tag | |
SafeCopy DeleteUser Source # | |
Defined in Happstack.Authenticate.Core Methods version :: Version DeleteUser kind :: Kind DeleteUser getCopy :: Contained (Get DeleteUser) putCopy :: DeleteUser -> Contained Put internalConsistency :: Consistency DeleteUser objectProfile :: Profile DeleteUser errorTypeName :: Proxy DeleteUser -> String | |
type MethodResult DeleteUser Source # | |
Defined in Happstack.Authenticate.Core type MethodResult DeleteUser = () | |
type MethodState DeleteUser Source # | |
Defined in Happstack.Authenticate.Core |
newtype GetUserByUsername Source #
Constructors
GetUserByUsername Username |
Instances
QueryEvent GetUserByUsername Source # | |
Defined in Happstack.Authenticate.Core | |
Method GetUserByUsername Source # | |
Defined in Happstack.Authenticate.Core Methods methodTag :: GetUserByUsername -> Tag | |
SafeCopy GetUserByUsername Source # | |
Defined in Happstack.Authenticate.Core Methods version :: Version GetUserByUsername kind :: Kind GetUserByUsername getCopy :: Contained (Get GetUserByUsername) putCopy :: GetUserByUsername -> Contained Put internalConsistency :: Consistency GetUserByUsername objectProfile :: Profile GetUserByUsername errorTypeName :: Proxy GetUserByUsername -> String | |
type MethodResult GetUserByUsername Source # | |
Defined in Happstack.Authenticate.Core | |
type MethodState GetUserByUsername Source # | |
Defined in Happstack.Authenticate.Core |
newtype GetUserByUserId Source #
Constructors
GetUserByUserId UserId |
Instances
QueryEvent GetUserByUserId Source # | |
Defined in Happstack.Authenticate.Core | |
Method GetUserByUserId Source # | |
Defined in Happstack.Authenticate.Core Methods methodTag :: GetUserByUserId -> Tag | |
SafeCopy GetUserByUserId Source # | |
Defined in Happstack.Authenticate.Core Methods version :: Version GetUserByUserId kind :: Kind GetUserByUserId getCopy :: Contained (Get GetUserByUserId) putCopy :: GetUserByUserId -> Contained Put internalConsistency :: Consistency GetUserByUserId objectProfile :: Profile GetUserByUserId errorTypeName :: Proxy GetUserByUserId -> String | |
type MethodResult GetUserByUserId Source # | |
Defined in Happstack.Authenticate.Core | |
type MethodState GetUserByUserId Source # | |
Defined in Happstack.Authenticate.Core |
newtype GetUserByEmail Source #
Constructors
GetUserByEmail Email |
Instances
QueryEvent GetUserByEmail Source # | |
Defined in Happstack.Authenticate.Core | |
Method GetUserByEmail Source # | |
Defined in Happstack.Authenticate.Core Methods methodTag :: GetUserByEmail -> Tag | |
SafeCopy GetUserByEmail Source # | |
Defined in Happstack.Authenticate.Core Methods version :: Version GetUserByEmail kind :: Kind GetUserByEmail getCopy :: Contained (Get GetUserByEmail) putCopy :: GetUserByEmail -> Contained Put internalConsistency :: Consistency GetUserByEmail objectProfile :: Profile GetUserByEmail errorTypeName :: Proxy GetUserByEmail -> String | |
type MethodResult GetUserByEmail Source # | |
Defined in Happstack.Authenticate.Core | |
type MethodState GetUserByEmail Source # | |
Defined in Happstack.Authenticate.Core |
data GetAuthenticateState Source #
Constructors
GetAuthenticateState |
Instances
QueryEvent GetAuthenticateState Source # | |
Defined in Happstack.Authenticate.Core | |
Method GetAuthenticateState Source # | |
Defined in Happstack.Authenticate.Core Associated Types type MethodResult GetAuthenticateState :: * type MethodState GetAuthenticateState :: * Methods methodTag :: GetAuthenticateState -> Tag | |
SafeCopy GetAuthenticateState Source # | |
Defined in Happstack.Authenticate.Core Methods version :: Version GetAuthenticateState kind :: Kind GetAuthenticateState getCopy :: Contained (Get GetAuthenticateState) putCopy :: GetAuthenticateState -> Contained Put internalConsistency :: Consistency GetAuthenticateState objectProfile :: Profile GetAuthenticateState errorTypeName :: Proxy GetAuthenticateState -> String | |
type MethodResult GetAuthenticateState Source # | |
Defined in Happstack.Authenticate.Core | |
type MethodState GetAuthenticateState Source # | |
Defined in Happstack.Authenticate.Core |
getOrGenSharedSecret :: MonadIO m => AcidState AuthenticateState -> UserId -> m SharedSecret Source #
get the SharedSecret
for UserId
. Generate one if they don't have one yet.
The Token
type represents the encrypted data used to identify a
user.
Constructors
Token | |
Fields
|
Instances
Eq Token Source # | |
Data Token Source # | |
Defined in Happstack.Authenticate.Core Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Token -> c Token # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Token # dataTypeOf :: Token -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Token) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Token) # gmapT :: (forall b. Data b => b -> b) -> Token -> Token # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Token -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Token -> r # gmapQ :: (forall d. Data d => d -> u) -> Token -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Token -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Token -> m Token # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Token -> m Token # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Token -> m Token # | |
Ord Token Source # | |
Read Token Source # | |
Show Token Source # | |
Generic Token Source # | |
ToJSON Token Source # | |
Defined in Happstack.Authenticate.Core | |
FromJSON Token Source # | |
type Rep Token Source # | |
Defined in Happstack.Authenticate.Core type Rep Token = D1 (MetaData "Token" "Happstack.Authenticate.Core" "happstack-authenticate-2.3.4.11-Bwj3cHLrT0KCBoc9b6QczY" False) (C1 (MetaCons "Token" PrefixI True) (S1 (MetaSel (Just "_tokenUser") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 User) :*: S1 (MetaSel (Just "_tokenIsAuthAdmin") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool))) |
Arguments
:: MonadIO m | |
=> AcidState AuthenticateState | |
-> AuthenticateConfig | |
-> User | the user |
-> m TokenText |
decodeAndVerifyToken :: MonadIO m => AcidState AuthenticateState -> UTCTime -> TokenText -> m (Maybe (Token, JWT VerifiedJWT)) Source #
addTokenCookie :: Happstack m => AcidState AuthenticateState -> AuthenticateConfig -> User -> m TokenText Source #
create a Token
for User
and add a Cookie
to the Response
see also: issueToken
getTokenCookie :: Happstack m => AcidState AuthenticateState -> m (Maybe (Token, JWT VerifiedJWT)) Source #
getTokenHeader :: Happstack m => AcidState AuthenticateState -> m (Maybe (Token, JWT VerifiedJWT)) Source #
get, decode, and verify the Token
from the Authorization
HTTP header
getToken :: Happstack m => AcidState AuthenticateState -> m (Maybe (Token, JWT VerifiedJWT)) Source #
get, decode, and verify the Token
looking first in the
Authorization
header and then in Cookie
.
see also: getTokenHeader
, getTokenCookie
newtype AuthenticationMethod Source #
AuthenticationMethod
is used by the routing system to select which
authentication backend should handle this request.
Constructors
AuthenticationMethod | |
Fields |
Instances
rAuthenticationMethod :: forall tok e r. Boomerang e tok ((:-) Text r) ((:-) AuthenticationMethod r) Source #
type AuthenticationHandler = [Text] -> RouteT AuthenticateURL (ServerPartT IO) Response Source #
data AuthenticateURL Source #
Constructors
AuthenticationMethods (Maybe (AuthenticationMethod, [Text])) | |
Controllers |
Instances
rAuthenticationMethods :: forall tok e r. Boomerang e tok ((:-) (Maybe (AuthenticationMethod, [Text])) r) ((:-) AuthenticateURL r) Source #
rControllers :: forall tok e r. Boomerang e tok r ((:-) AuthenticateURL r) Source #
authenticateURL :: Router () (AuthenticateURL :- ()) Source #
a Router
for AuthenicateURL
nestAuthenticationMethod :: PathInfo methodURL => AuthenticationMethod -> RouteT methodURL m a -> RouteT AuthenticateURL m a Source #
helper function which converts a URL for an authentication
backend into an AuthenticateURL
.