y      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~   ! None          None !"#$%&'()*  !"#$%&'()*None +,-./012345 +,-./01234 +,-./012345None6789:;<=>?@ABCDEFGHIJKLMNOPQRS6789:;<=>?@ABCDEFGHIJKLMNO 6789:;<=>?@EDCBAFGHIJNMLKOPQRSNoneTUVWXYZTUVWXYTUVWXYZNone[\]^_%6789:;<=>?@ABCDEFGHIJKLMNOTUVWXY[\]^_[\]^_None`a`a`aNone6789:;<=>?@ABCDEFGHIJKLMNV[NonebcdefghibcdefghibcdefghiNonejIGiven a set of roles to check, and a set of implication rules describing M how a given role inherits from other roles, this function produces a stream A of expanded Roles. If a Role is seen twice, expandRoles mzeros. #klmnopqjrstuvwxyz{|}~#klmnopqjrstuvwxyz{|}~#klmnopqjrstuvwxyz{|}~None #Load a session from given payload. IWill always be called before any other operation. If possible, cache and F do nothing when called multiple times within the same request cycle. 2Commit session, return a possibly updated paylaod Reset session Touch session %Insert a key-value pair into session Lookup a key in session Delete a key in session 5Return a session-specific CSRF protection token. See  mkCSRFToken for  help in creating the value. 2Return all key-value pairs as an association list +Any Haskell record that is a member of the  # typeclass can be stuffed inside a   to enable all  session-related functionality. DTo use sessions in your application, just find a Backend that would $ produce one for you inside of your  Initializer. See  initCookieSessionManager in   for a built-in option  that would get you started.       None Serialize UTCTime !instance Serialize UTCTime where = put t = put (round (utcTimeToPOSIXSeconds t) :: Integer) 0 get = posixSecondsToUTCTime . fromInteger  $ get "Arbitrary payload with timestamp. Inject the payload )Validate session against timeout policy.  If timeout is set to , never trigger a time-out. H Otherwise, do a regular time-out check based on current time and given  timestamp.   Cookie name Encryption key Timeout in seconds  Cookie name Encryption key Max age in seconds Serializable payload   None2High speed, mutable random number generator state -Perform given action, mutating the RNG state Create a new RNG (Generates a random salt of given length !Generate a randomized CSRF token NoneDAppConfig contains the config options for command line arguments in  snaplet-based apps. FAppConfig has a manual instance of Typeable due to limitations in the F tools available before GHC 7.4, and the need to make dynamic loading F tractable. When support for earlier versions of GHC is dropped, the I dynamic loader package can be updated so that manual Typeable instances  are no longer needed. /Command line options for snaplet applications. Calls snap-server'6s extendedCommandLineConfig to add snaplet options to + the built-in server command line options. None+HAn opaque data type holding internal snaplet configuration data. It is H exported publicly because the getOpaqueConfig function in MonadSnaplet C makes implementing new instances of MonadSnaplet more convenient. ;Holds the actual route pattern passed to addRoutes for the B current handler. Nothing during initialization and before route  dispatech. @This is the universal reload action for the top-level site. We  can'<t update this in place to be a reloader for each individual ( snaplet because individual snaplets can't be reloaded in isolation < without losing effects that subsequent hooks may have had. Snaplet's type parameter s- here is user-defined and can be any Haskell  type. A value of type  Snaplet s countains a couple of things:  a value of type s , called the " user state". H some bookkeeping data the framework uses to plug things together, like  the snaplet's configuration, the snaplet's root directory on the  filesystem, the snaplet's root URL, and so on. @See the _reloader comment for why we have to use this to reload / single snaplets in isolation. This action won't actually run the E initializer at all. It will only modify the existing state. It is A the responsibility of the snaplet author to avoid using this in E situations where it will destroy data in its state that was created  by subsequent hook actions. 2Joins a reversed list of directories into a path. 2Joins a reversed list of directories into a path. &Monad used for initializing snaplets. DWrapper around IO actions that modify state elements created during  initialization. @Information about a partially constructed initializer. Used to 7 automatically aggregate handlers and cleanup actions. -Handler routes built up and passed to route. Generic filtering of handlers :This snaplet config is the incrementally built config for 2 whatever snaplet is currently being constructed. We can'/t just hae a simple MVar here because MVars can't be  chrooted. FSnaplet infrastructure is available during runtime request processing ' through the Handler monad. There aren'$t very many standalone functions to G read about here, but this is deceptive. The key is in the type class ' instances. Handler is an instance of , which means it is the I monad you will use to write all your application routes. It also has a  ; instance, which gives you all the functionality described  above. CThe m type parameter used in the MonadSnaplet type signatures will M usually be either Initializer or Handler, but other monads may sometimes be  useful. Minimal complete definition:  #, ", $, and %. 2Runs a child snaplet action in the current snaplet's context. If you G think about snaplet lenses using a filesystem path metaphor, the lens H supplied to this snaplet must be a relative path. In other words, the  lens'6s base state must be the same as the current snaplet. !Like   but doesn')t impose the requirement that the action I being run be a descendant of the current snaplet. Using our filesystem @ metaphor again, the lens for this function must be an absolute  path--it'-s base must be the same as the current base. " A variant of  3 accepting a lens from snaplet to snaplet. Unlike  the lens used in the above  % function, this lens formulation has C an identity, which makes it useful in certain circumstances. The  lenses generated by # will not work with this function,  however the lens returned by $ will.  with = with' . subSnaplet#The absolute version of " $'Gets the lens for the current snaplet. %Gets the current snaplet's opaque config data type. You' ll only use 4 this function when writing MonadSnaplet instances. )ITransforms a lens of the type you get from makeLenses to an similar lens ) that is more suitable for internal use. *FGets a list of the names of snaplets that are direct ancestors of the  current snaplet. +Gets the snaplet's path on the filesystem. ,Gets the current snaple's name. -2Gets a human readable description of the snaplet. .8Gets the config data structure for the current snaplet. /EGets the base URL for the current snaplet. Directories get added to & the current snaplet path by calls to  nestSnaplet. 02Constructs a url relative to the current snaplet. 1 Gets the  Snaplet v from the current snaplet' s state. 2 Puts a new  Snaplet v in the current snaplet' s state. 3 Modifies the  Snaplet v in the current snaplet' s state. 4 Gets the  Snaplet v from the current snaplet's state and applies a  function to it. Like runBase, but it doesn'"t require an MVar to be executed. 5IGets the route pattern that matched for the handler. This lets you find A out exactly which of the strings you used in addRoutes matched. 6GSets the route pattern that matched for the handler. Use this when to F override the default pattern which is the key to the alist passed to  addRoutes. 72Pass if the request is not coming from localhost. 8Handler that reloads the site. 9DThis function brackets a Handler action in resource acquisition and  release. Like (, this is provided because MonadCatchIO's   function doesn'/t work properly in the case of a short-circuit ) return from the action being bracketed. ;In order to prevent confusion regarding the effects of the D aquisition and release actions on the Handler state, this function  doesn'=t accept Handler actions for the acquire or release actions. AThis function will run the release action in all cases where the B acquire action succeeded. This includes the following behaviors ! from the bracketed Snap action.  Normal completion / Short-circuit completion, either from calling  or   An exception being thrown. ?The MonadState instance gives you access to the current snaplet' s state. ?The MonadState instance gives you access to the current snaplet' s state. :GOpaque newtype which gives us compile-time guarantees that the user is E using makeSnaplet and either nestSnaplet or embedSnaplet correctly. T &A relative lens identifying a snaplet Action from the lense' s snaplet !An "absolute" lens identifying a snaplet Action from the lense' s snaplet "#$%&'()*+,-./0123456789:O !"#$%&'()*+,-./0123456789:4   !"#$%&'()*+,-./0123456789:None" for InitializerState.  for InitializerState.  for InitializerState. ;ILets you retrieve the list of routes currently set up by an Initializer. " This can be useful in debugging. <9Return the current environment string. This will be the  environment given to H or from the command line when  using J). Usefully for changing behavior during  development and testing. +Converts a plain hook into a Snaplet hook. =GAdds an IO action that modifies the current snaplet state to be run at I the end of initialization on the state that was created. This makes it  easier to allow one snaplet')s state to be modified by another snaplet's K initializer. A good example of this is when a snaplet has templates that 3 define its views. The Heist snaplet provides the  addTemplates function = which allows other snaplets to set up their own templates.  addTemplates % is implemented using this function. >JVariant of addPostInitHook for when you have things wrapped in a Snaplet. (Helper function for transforming hooks. (Helper function for transforming hooks. Modifies the Initializer's SnapletConfig. IIf a snaplet has a filesystem presence, this function creates and copies  the files if they dont' already exist. ?6All snaplet initializers must be wrapped in a call to  makeSnaplet, A which handles standardized housekeeping common to all snaplets. ' Common usage will look something like  this:    fooInit :: SnapletInit b Foo  fooInit = makeSnaplet "foo" "An example snaplet" Nothing $ do # -- Your initializer code here  return $ Foo 42  Note that you';re writing your initializer code in the Initializer monad, K and makeSnaplet converts it into an opaque SnapletInit type. This allows E us to use the type system to ensure that the API is used correctly. EInternal function that gets the SnapletConfig out of the initializer , state and uses it to create a (Snaplet a). CBrackets an initializer computation, restoring curConfig after the  computation returns. GHandles modifications to InitializerState that need to happen before a < snaplet is called with either nestSnaplet or embedSnaplet. @Runs another snaplet'2s initializer and returns the initialized Snaplet J value. Calling an initializer with nestSnaplet gives the nested snaplet L access to the same base state that the current snaplet has. This makes it I possible for the child snaplet to make use of functionality provided by  sibling snaplets. ARuns another snaplet'2s initializer and returns the initialized Snaplet G value. The difference between this and nestSnaplet is the first type ' parameter in the third argument. The "v1 v1" makes the child snaplet I think that it is top-level, which means that it will not be able to use K functionality provided by snaplets included above it in the snaplet tree. M This strongly isolates the child snaplet, and allows you to eliminate the b M type variable. The embedded snaplet can still get functionality from other > snaplets, but only if it nests or embeds the snaplet itself. *Changes the base state of an initializer. %Changes the base state of a handler. BSets a snaplet'5s name. All snaplets have a default name set by the L snaplet author. This function allows you to override that name. You will H have to do this if you have more than one instance of the same kind of C snaplet because snaplet names must be unique. This function must ! immediately surround the snaplet's initializer. For example:  fooState <- nestSnaplet "fooA" $ nameSnaplet "myFoo" $ fooInitCAdds routing to the current ". The new routes are merged with M the main routing section and take precedence over existing routing that was  previously defined. D Wraps the base snaplet'2s routing in another handler, allowing you to run 5 code before and after all routes in an application. /Here are some examples of things you might do: C wrapSite (\site -> logHandlerStart >> site >> logHandlerFinished) - wrapSite (\site -> ensureAdminUser >> site) EGAttaches an unload handler to the snaplet. The unload handler will be 4 called when the server shuts down, or is reloaded. FEInitializers should use this function for all informational or error L messages to be displayed to the user. On application startup they will be J sent to the console. When executed from the reloader, they will be sent ( back to the user in the HTTP response. <Builds an IO reload action for storage in the SnapletState. ,Runs a top-level snaplet in the Snap monad. GLets you change a snaplet's initial state. It's alomst like a reload,  except that it doesn'7t run the initializer. It just modifies the result of L the initializer. This can be used to let you define actions for reloading  individual snaplets. DInternal function for running Initializers. If any exceptions were I thrown by the initializer, this function catches them, runs any cleanup I actions that had been registered, and returns an expanded error message K containing the exception details as well as all messages generated by the . initializer before the exception was thrown. HKGiven an environment and a Snaplet initializer, produce a concatenated log H of all messages generated during initialization, a snap handler, and a A cleanup action. The environment is an arbitrary string such as "devel" or  " production"4. This string is used to determine the name of the L configuration files used by each snaplet. If an environment of Nothing is # used, then runSnaplet defaults to "devel". IFGiven a configuration and a snap handler, complete it and produce the L completed configuration as well as a new toplevel handler with things like ' compression and a 500 handler set up. JKInitialize and run a Snaplet. This function parses command-line arguments, K runs the given Snaplet initializer, and starts an HTTP server running the  Snaplet' s toplevel . K!Allows you to get all of your app'&s config data in the IO monad without  the web server infrastructure. $Recursive worker for loadAppConfig. *;<=>The directory where the snaplet's reference files are & stored. Nothing if the snaplet doesn't come with any " files that need to be installed. ,Directory where the files should be copied. ?7A default id for this snaplet. This is only used when 2 the end-user has not already set an id using the  nameSnaplet function. .A human readable description of this snaplet. -The path to the directory holding the snaplet' s reference 5 filesystem content. This will almost always be the  directory returned by Cabal's getDataDir command, but it 0 has to be passed in because it is defined in a 9 package-specific import. Setting this value to Nothing  doesn'3t preclude the snaplet from having files in in the ( filesystem, it just means that they won't be copied there  automatically. Snaplet initializer. @ The root url for all the snaplet's routes. An empty 5 string gives the routes the same root as the parent  snaplet' s routes. Lens identifying the snaplet -The initializer function for the subsnaplet. A The root url for all the snaplet's routes. An empty 5 string gives the routes the same root as the parent  snaplet' s routes. 4NOTE: Because of the stronger isolation provided by 9 embedSnaplet, you should be more careful about using an  empty string here. Lens identifying the snaplet -The initializer function for the subsnaplet. BThe snaplet name !The snaplet initializer function CDHandler modifier function EFGHIJ9The configuration of the server - you can usually pass a  default  via  . "The snaplet initializer function. K2The name of the config file to look for. In snap . applications, this is something based on the  environment...i.e.  devel.cfg. ,Path to the root directory of your project. ;<=>?@ABCDEFGHIJK*;<=>?@ABCDEFGHIJKNone1 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJK1'() !"#$%*+,-./0561234:?@ABE=>F;<CD78G9HIJK&NoneLGThe state for the Heist snaplet. To use the Heist snaplet in your app 0 include this in your application state and use  heistInit to initialize J it. The type parameter b will typically be the base state type for your  application. 1Generic initializer function that allows compiled/interpreted template ( serving to be specified by the caller. AInternal worker function used by variants of heistInit. This is F necessary because of the divide between SnapletInit and Initializer. IHook that converts the Heist type from Configuring to Running at the end  of initialization. PGHandler that triggers a template reload. For large sites, this can be E desireable because it may be much quicker than the full site reload  provided at the admin2reload route. This allows you to reload only the L heist templates This handler is automatically set up by heistInit, but if  you use heistInit'., then you can create your own route with it. LMNOPLMNOP LMONPNoneTJClears data stored by the cache tag. The cache tag automatically reloads H its data when the specified TTL expires, but sometimes you may want to ; trigger a manual reload. This function lets you do that. UThe  for L). This function is a convenience wrapper  around V8 that uses defaultHeistState and sets up routes for all  the templates. It sets up a " heistReload" route that reloads the heist / templates when you request it from localhost. VA lower level  for L!. This initializer requires you J to specify the initial HeistConfig. It also does not add any routes for K templates, allowing you complete control over which templates get routed. WASets the snaplet to default to interpreted mode. Initially, the K initializer sets the value to compiled mode. This function allows you to K override that setting. Note that this is just a default. It only has an 1 effect if you use one of the generic functions: i, j,  k, or l. If you call the non-generic M versions directly, then this value will not be checked and you will get the . mode implemented by the function you called. XDAdds templates to the Heist HeistConfig. Other snaplets should use L this function to add their own templates. The templates are automatically 9 read from the templates directory in the current snaplet's filesystem root. YDAdds templates to the Heist HeistConfig, and lets you specify where G they are found in the filesystem. Note that the path to the template K directory is an absolute path. This allows you more flexibility in where H your templates are located, but means that you have to explicitly call I getSnapletFilePath if you want your snaplet to use templates within its  normal directory structure. _DAdds more HeistConfig data using mappend with whatever is currently K there. This is the preferred method for adding all four kinds of splices  as well as new templates. (Internal helper function for rendering. (Internal helper function for rendering. hIChooses between a compiled action and an interpreted action based on the  configured default. i Like render/<cRender, but chooses between the two appropriately based on  the default mode. j Like renderAs/;cRenderAs, but chooses between the two appropriately based  on the default mode. kLike heistServe/7cHeistServe, but chooses between the two appropriately  based on the default mode. lLike heistServeSingle//cHeistServeSingle, but chooses between the two * appropriately based on the default mode. $This instance is here because we don'#t want the heist package to depend ! on anything from snap packages. 'QRSTUPath to templates VPath to templates Initial HeistConfig WX'The url prefix for the template routes YURL prefix for template routes Path to templates Z[\]^_`Name of the template a Content type Name of the template bcdName of the template e Content type Name of the template fghA compiled action An interpreted action iName of the template j Content type Name of the template klmnopqr'LMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr'LMONUVPWZTXY\[^]ijklh_defg`abcnprmoqSQR'QRSTUVWXYZ[\]^_`abcdefghijklmnopqrNonesHA single snaplet should never need more than one instance of Heist as a L subsnaplet. This type class allows you to make it easy for other snaplets 9 to get the lens that identifies the heist snaplet. Here's an example of * how the heist snaplet might be declared: 2 data App = App { _heist :: Snaplet (Heist App) }  makeLenses ''App  : instance HasHeist App where heistLens = subSnaplet heist  - appInit = makeSnaplet "app" "" Nothing $ do < h <- nestSnaplet "heist" heist $ heistInit "templates" - addConfig h heistConfigWithMyAppSplices  return $ App h t<A lens to the Heist snaplet. The b parameter to Heist will 2 typically be the base state of your application. uCAdds templates to the Heist HeistState. Other snaplets should use L this function to add their own templates. The templates are automatically 9 read from the templates directory in the current snaplet's filesystem root. vCAdds templates to the Heist HeistState, and lets you specify where G they are found in the filesystem. Note that the path to the template K directory is an absolute path. This allows you more flexibility in where H your templates are located, but means that you have to explicitly call I getSnapletFilePath if you want your snaplet to use templates within its  normal directory structure. wBMore general function allowing arbitrary HeistState modification. x)Runs a function on with the Heist snaplet's . yGeneric version of 'render'/'cRender'. zGeneric version of 'renderAs'/'cRenderAs'. {Generic version of 'heistServe'/'cHeistServe'. |Generic version of &'heistServeSingle'/'cHeistServeSingle'. }IChooses between a compiled action and an interpreted action based on the  configured default. ~#Renders a compiled template as text/#html. If the given template is not  found, this returns empty. ERenders a compiled template as the given content type. If the given % template is not found, this returns empty. A compiled version of .  Analogous to fileServeSingle&. If the given template is not found,  this throws an error. Renders a template as text/*html. If the given template is not found,  this returns empty. ERenders a template as the given content type. If the given template  is not found, this returns empty. 4A handler that serves all the templates (similar to serveDirectory). H If the template specified in the request path is not found, it returns  emptyC. Also, this function does not serve any templates beginning with K an underscore. This gives you a way to prevent some templates from being H served. For example, you might have a template that contains only the . navbar of your pages, and you probably wouldn't want that template to be K visible to the user as a standalone template. So if you put it in a file  called "_nav.tpl", this function won' t serve it. 2Handler for serving a single template (similar to fileServeSingle). If 8 the given template is not found, this throws an error. JRenders a template with a given set of splices. This is syntax sugar for > a common combination of heistLocal, bindSplices, and render. <Runs an action with additional splices bound into the Heist  . Runs a handler with a modified . You might want to use G this if you had a set of splices which were customised for a specific # action. To do that you would do: < heistLocal (bindSplices mySplices) handlerThatNeedsSplices stu'The url prefix for the template routes vURL prefix for template routes Path to templates wHeistState modifying function xHeistState function to run yTemplate name zContent type to render with Template name {|Template name }A compiled action An interpreted action ~Template name Content type to render with Template name Template name Template name Content type to render with Template name Template name Template name Splices to bind Splices to bind Handler to run HeistState modifying function Handler to run !LPQRSTUVWZ_stuvwxyz{|}~!LstUVPWZuv_wxyz{|}~SRQTstuvwxyz{|}~NoneLRST_stuvwxyz{|}LstSRuv_wxyz{|}T NoneLQSTUV_stuvwxLstSQUVuv_wxTNoneThe  for L). This function is a convenience wrapper  around  heistInit'8 that uses defaultHeistState and sets up routes for all  the templates. It sets up a " heistReload" route that reloads the heist / templates when you request it from localhost. #Renders a compiled template as text/#html. If the given template is not  found, this returns empty. ERenders a compiled template as the given content type. If the given % template is not found, this returns empty. 4A handler that serves all the templates (similar to serveDirectory). H If the template specified in the request path is not found, it returns  emptyC. Also, this function does not serve any templates beginning with K an underscore. This gives you a way to prevent some templates from being H served. For example, you might have a template that contains only the . navbar of your pages, and you probably wouldn't want that template to be K visible to the user as a standalone template. So if you put it in a file  called "_nav.tpl", this function won' t serve it. 2Handler for serving a single template (similar to fileServeSingle). If 8 the given template is not found, this throws an error. Path to templates Template name Content type to render with Template name Template name LPRSTV_stuvwxLstSRVPuv_wxT!None6Authetication settings defined at initialization time Currently not used/checked $Name of the desired remember cookie AHow long to remember when the option is used in rest of the API.  & means remember until end of session. Lockout strategy: ([MaxAttempts], [LockoutDuration]) Location of app's encryption key =Type representing the concept of a User in your application. 9This will be replaced by a role-based permission system. Internal representation of a User$. By convention, we demand that the ) application is able to directly fetch a User using this identifier. HThink of this type as a secure, authenticated user. You should normally ; never see this type unless a user has been authenticated. HAuthentication failures indicate what went wrong during authentication. F They may provide useful information to the developer, although it is L generally not advisable to show the user the exact details about why login  failed. Locked out until given time EPassword is clear when supplied by the user and encrypted later when  returned from the db. 2Default strength level to pass into makePassword. <The underlying encryption function, in case you need it for  external processing. AThe underlying verify function, in case you need it for external  processing. Turn a  password into an  password, ready to  be stuffed into a database. ,Default AuthUser that has all empty values. @Set a new password for the given user. Given password should be ) clear-text; it will be encrypted into a . Default settings for Auth.  asMinPasswdLen = 8 $ asRememberCookieName = "_remember" 2 asRememberPeriod = Just (2*7*24*60*60) = 2 weeks  asLockout = Nothing  asSiteKey = "site_key.txt" HFunction to get auth settings from a config file. This function can be L used by the authors of auth snaplet backends in the initializer to let the F user configure the auth snaplet from a config file. All options are  optional and default to what'&s in defAuthSettings if not supplied.  Here'?s what the default options would look like in the config file:  minPasswordLen = 8  rememberCookie = "_remember" $ rememberPeriod = 1209600 # 2 weeks C lockout = [5, 86400] # 5 attempts locks you out for 86400 seconds  siteKey = "site_key.txt" ? Cleartext Encrypted reference 8 None HWrap around a handler, committing any changes in the session at the end ;Commit changes to session within the current request cycle ,Set a key-value pair in the current session #Get a key from the current session &Remove a key from the current session 3Returns a CSRF Token unique to the current session /Return session contents as an association list >Deletes the session cookie, effectively resetting the session 0Touch the session so the timeout gets refreshed "Load the session into the manager    "None HAbstract data type holding all necessary information for auth operation Storage back-end #A lens pointer to a SessionManager #A per-request logged-in user cache Password length range #Cookie name for the remember token 1Remember period in seconds. Defaults to 2 weeks. 8A unique encryption key used to encrypt remember cookie 6Lockout after x tries, re-allow entry after y seconds Random number generator 6All storage backends need to implement this typeclass Create or update the given  record. A  of Nothing A indicates that a new user should be created, otherwise the user 0 information for that userId should be updated. 1Creates a new user from a username and password. An auth backend  Username  Password  #None4Create a new user from just a username and password 5Check whether a user with the given username exists. FLookup a user by her username, check given password and perform login DRemember user from the remember token if possible and perform login Logout the active user EReturn the current user; trying to remember from cookie if possible. Convenience wrapper around  rememberUser that returns a bool result Create or update a given user Destroy the given user  Mutate an  , marking failed authentication (This will save the user to the backend.  Mutate an $, marking successful authentication (This will save the user to the backend. FAuthenticate and log the user into the current session if successful. LThis is a mid-level function exposed to allow roll-your-own ways of looking  up a user from the database. This function will:  Check the password ) Login the user into the current session  Mark success/7failure of the authentication trial on the user record Login and persist the given  in the active session JMeant to be used if you have other means of being sure that the person is  who she says she is. Set the current user's  in the active session  Remove 8 from active session, effectively logging the user out.  Get the current user's  from the active session !Check password for a given user. Returns Nothing if check is successful and an IncorrectPassword error  otherwise  (Wrap lookups around request-local cache 5Register a new user by specifying login and password Param fields A & handler that processes a login form. %The request paremeters are passed to  performLogin ETo make your users stay logged in for longer than the session replay K prevention timeout, you must pass a field name as the third parameter and & that field must be set to a value of "1" by the submitting form. This L lets you use a user selectable check box. Or if you want user remembering 4 always turned on, you can use a hidden form field. ?Simple handler to log the user out. Deletes user from session. Require that an authenticated  is present in the current  session. JThis function has no DB cost - only checks to see if a user_id is present  in the current session. 6Run a function on the backend, and return the result. <This uses an existential type so that the backend type doesn't  escape5 AuthManager. The reason that the type is Handler b ? (AuthManager v) a and not a is because anything that uses the A backend will return an IO something, which you can liftIO, or a > Handler b (AuthManager v) a if it uses other handler things. GThis function generates a random password reset token and stores it in J the database for the user. Call this function when a user forgets their H password. Then use the token to autogenerate a link that the user can L visit to reset their password. This function also sets a timestamp so the  reset token can be expired.  Clears a user'1s password reset token. Call this when the user L successfully changes their password to ensure that the password reset link  cannot be used again.  GHelper function used for setting and clearing the password reset token  and associated timestamp.  Username  Password The username to be checked Username/login for user Should be ClearText Set remember token? ,An existing user, somehow looked up from db A ClearText password ,An existing user, somehow looked up from db    Looked up from the back-end Check against this password  9Lookup action to perform if request local cache is empty  Login field Password field Username field Password field :Remember field; Nothing if you want no remember function.  Upon failure  Upon success What to do after logging out Lens reference to an  AuthManager -Do this if no authenticated user is present. -Do this if an authenticated user is present. &The function to run with the handler.            $None >Add all standard auth splices to a Heist-enabled application. !This adds the following splices:  < ifLoggedIn>  < ifLoggedOut>  < loggedInUser> BList containing compiled splices for ifLoggedIn, ifLoggedOut, and  loggedInUser. ;Function to generate interpreted splices from an AuthUser. Compiled splices for AuthUser. IA splice that can be used to check for existence of a user. If a user is 2 present, this will run the contents of the node. E <ifLoggedIn> Show this when there is a logged in user </ifLoggedIn> IA splice that can be used to check for existence of a user. If a user is 2 present, this will run the contents of the node. E <ifLoggedIn> Show this when there is a logged in user </ifLoggedIn> GA splice that can be used to check for absence of a user. If a user is 6 not present, this will run the contents of the node. G <ifLoggedOut> Show this when there is a logged in user </ifLoggedOut> GA splice that can be used to check for absence of a user. If a user is 6 not present, this will run the contents of the node. G <ifLoggedOut> Show this when there is a logged in user </ifLoggedOut> 0A splice that will simply print the current user' s login, if  there is one. 0A splice that will simply print the current user' s login, if  there is one. A lens reference to     Nonedd NoneHJSON user back-end stores the user data and indexes for login and token  based logins. the actual datastore fast lookup for login field  fast lookup for remember tokens user id counter Initialize a JSON file backed  Load/<create a datafile into memory cache and return the manager. .This data type can be used by itself for batch/non-handler processing.  %Authentication settings for your app  Lens into a   auth snaplet will  use !Where to store user data as JSON !"#$%&'()*+ !"#$%&'()*+ None ,2A session payload to be stored in a SecureCookie. -)The manager data type to be stuffed into   .Per request cache for / 07A long encryption key used for secure cookie transport 1#Cookie name for the session system 2#Session cookies will be considered stale after this many  seconds. 3$handle to a random number generator /This is what the ,' will be for the CookieSession backend 4Session data are kept in a 5 for this backend 0Initialize a cookie-backed session, returning a   to be  stuffed inside your application's state. This   will enable 9 the use of all session storage functionality defined in  % 6"Get the current client-side value 7Set the client-side value ,8-9.0123/:;<4=>?@A!Path to site-wide encryption key Session cookie name ,Session time-out (replay attack protection) 67BC,8-9.0123/:;<4=>?@A67BC NoneERemove the given file before running an IO computation. Obviously it  can be used with  Assertion. D"Utility function taken from Darcs Given a Snaplet Handler and a E defining 5 a test request, runs the Handler, producing an HTTP F. ANote that the output of this function is slightly different from  7 defined in Snap.Test, because due to the fact running  the initializer inside : can throw an exception. Given a Snaplet Handler, a : specifying the initial state,  and a E, defining a test request, runs the handler, + returning the monadic value it produces. Throws an exception if the G handler early-terminates with   or mzero. ANote that the output of this function is slightly different from  'BevalHandler defined in Snap.Test, because due to the fact running  the initializer inside : can throw an exception. HGRun the given initializer, yielding a tuple where the first element is  a  Snaplet b7, or an error message whether the initializer threw an C exception. DHDH&NonelIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~G      !"#$%&'()*+,-./0123456789:;<=>?@ABCFDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxy !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKz'()*+,-./01123456789:;;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~}~z!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"""""""""""""""""#####################$$$$$$$                         FE !"#$%&'()*+,-../0123FE45567899:;<=>?@ABCDEFGHIJKLMNOOPPQRSTTUUVWXYYZ-.,[\]^_`abcdefghijklmnopqrstuvwxyz{|}~6@ABC_!!!!!!!!""######## # $ $ $                      ! " # $ %  & ' %()* + , $ %  - . / 0 1 2 3 4 5 6789:& ;<=>?@ABCBDEF@GBHIJIKLMI[INIOIPBQBRISITIUIVIWIXIYIZI[I\I]I]I^I_I`IaIbIcIdIeIefgBhBiBjBkBlBmBnBoBpBqBrBsBtBuBvBwBxByBzB{B|B}B~BBBBBB99999999999999999999 9 9 9 9 99999999999999999999 9!9"9#9$9%9&9&9&9'9(9(9)9*9+9,9-9.9/909192939495969798999:9;9<9=>?@A@B@C@D@EFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstu snap-0.13.0.2#Snap.Snaplet.Session.SessionManagerSnap.Snaplet.SessionSnap.Snaplet.Session.CommonSnap.Snaplet.Config Snap.SnapletSnap.Snaplet.HeistNoClassSnap.Snaplet.HeistSnap.Snaplet.Heist.CompiledSnap.Snaplet.Auth#Snap.Snaplet.Auth.Backends.JsonFile+Snap.Snaplet.Session.Backends.CookieSessionSnap.Snaplet.TestSnap.Snaplet.Internal.RSTSnap.Snaplet.Internal.LensedSnap.Snaplet.Internal.LensT&Control.Access.RoleBased.Internal.Role&Control.Access.RoleBased.Internal.Rule'Control.Access.RoleBased.Internal.TypesControl.Access.RoleBased.RoleControl.Access.RoleBased.Types)Control.Access.RoleBased.Internal.RoleMap Control.Access.RoleBased.CheckerSnap.Snaplet.Session.Backends CookieSession!Snap.Snaplet.Session.SecureCookieSnap.Snaplet.Internal.Types!Snap.Snaplet.Internal.InitializerSnap.Http.Server.Config defaultConfigSnap.Snaplet.Heist.InternalSnap.Snaplet.Heist.GenericSnap.Snaplet.Heist.InterpretedSnap.Snaplet.Auth.TypesSnap.Snaplet.Auth.AuthManagerSnap.Snaplet.Auth.HandlersSnap.Snaplet.Auth.SpliceHelpersSessionSnapISessionManagerloadcommitresettouchinsertlookupdeletecsrftoListSessionManager SecureCookiegetSecureCookiesetSecureCookie checkTimeoutRNGwithRNGmkRNG randomToken mkCSRFToken AppConfigappEnvironmentappConfigTyConappOptscommandLineAppConfig SnapletConfigSnaplet InitializerHandler MonadSnapletwithwithTopwith'withTop'getLensgetOpaqueConfig SnapletLens snapletConfig snapletValue subSnapletgetSnapletAncestrygetSnapletFilePathgetSnapletNamegetSnapletDescriptiongetSnapletUserConfiggetSnapletRootURL snapletURLgetSnapletStateputSnapletStatemodifySnapletStategetsSnapletStategetRoutePatternsetRoutePatternfailIfNotLocal reloadSitebracketHandler SnapletInit getRoutesgetEnvironmentaddPostInitHookaddPostInitHookBase makeSnaplet nestSnaplet embedSnaplet nameSnaplet addRouteswrapSiteonUnload printInfo modifyMaster runSnaplet combineConfig serveSnaplet loadAppConfigHeist DefaultMode InterpretedCompiled heistReloaderSnapletISpliceSnapletCSplice SnapletHeistclearHeistCache heistInit heistInit'setInterpreted addTemplatesaddTemplatesAtgetCurHeistConfigmodifyHeistState'modifyHeistStatewithHeistState'withHeistState addConfigrenderrenderAs heistServeheistServeSinglecRender cRenderAs cHeistServecHeistServeSingle chooseModegRender gRenderAs gHeistServegHeistServeSingle heistLocal' heistLocal withSplices' withSplicesrenderWithSplices'renderWithSplicesHasHeist heistLens AuthSettingsasMinPasswdLenasRememberCookieNameasRememberPeriod asLockout asSiteKeyAuthUseruserId userLogin userEmail userPassworduserActivatedAtuserSuspendedAtuserRememberTokenuserLoginCountuserFailedLoginCountuserLockedOutUntiluserCurrentLoginAtuserLastLoginAtuserCurrentLoginIpuserLastLoginIp userCreatedAt userUpdatedAtuserResetTokenuserResetRequestedAt userRolesuserMetaRoleUserIdunUid AuthFailure UserNotFoundUsernameMissingPasswordMissing LockedOutIncorrectPasswordEncryptedPasswordDuplicateLogin BackendError AuthErrorPassword Encrypted ClearTextencryptverifyencryptPassword checkPassword defAuthUser setPassworddefAuthSettingsauthSettingsFromConfig withSession commitSession setInSessiongetFromSessiondeleteFromSession csrfToken sessionToList resetSession touchSession AuthManagerbackendsession activeUser minPasswdLenrememberCookieNamerememberPeriodsiteKeylockoutrandomNumberGenerator IAuthBackendsavelookupByUserId lookupByLoginlookupByRememberTokendestroy createUserusernameExistsloginByUsernameloginByRememberTokenlogout currentUser isLoggedInsaveUser destroyUser markAuthFailmarkAuthSuccesscheckPasswordAndLogin forceLoginauthenticatePassword registerUser loginUser logoutUser requireUser withBackendsetPasswordResetTokenclearPasswordResetTokenaddAuthSplicescompiledAuthSplices userISplices userCSplices ifLoggedIn ifLoggedOut loggedInUserinitJsonFileAuthManager mkJsonAuthMgrinitCookieSessionManagerwithTemporaryFile runHandler evalHandlerRSTrunRSTevalRSTexecRSTwithRSTmapRSTrwsBind $fMonadIORST$fMonadTransRST$fMonadPlusRST $fMonadRST$fMonadSnapRST$fMonadCatchIORST$fMonadStatesRST$fAlternativeRST$fApplicativeRST $fFunctorRST$fMonadReaderrRSTLensedunlensed lensedLocalglobally lensedAsStategetBaseembedlocally runLensed$fMonadSnapLensed$fAlternativeLensed$fMonadPlusLensed$fMonadCatchIOLensed$fMonadIOLensed$fMonadTransLensed$fMonadReader(->)Lensed$fMonadStatevLensed $fMonadLensed$fApplicativeLensed$fFunctorLensedLensTputBaselGetlPutrunLensT withLensT$fMonadStatevLensT RoleMetadata_roleMetadataName_roleDescription _roleDataDefsRoleDataDefinition _roleDataName_roleValueMeta_roleDataDescription RoleValueMetaRoleDoubleMeta RoleIntMeta RoleEnumMeta RoleTextMeta RoleBoolMeta _roleName _roleData RoleValue RoleDoubleRoleIntRoleTextRoleBool toSortedList$fHashableRole$fIsStringRole$fHashableRoleValue$fIsStringRoleValueRuleSetRule ruleToSet rulesToSet$fMonoidRuleSet RuleChecker RoleMonad_unRCmatches addRoleDataRoleMapfromListemptynull expandRoles RoleBuilder applyRule applyRuleSet checkUnseen checkSeenmarkSeenisumhasRole missingRole hasAllRoles hasAnyRolesrunRuleCheckermkRuleimplies impliesWith testRulestXt1t2t3t4t5t6t7t8t9t10t11t12t13t14t15t16t17base Data.MaybeNothing$fMonoidAppConfig$fTypeableAppConfig_scRoutePattern _reloader_snapletModifier buildPath getRootURLHookInitializerState _handlers_hFilter _curConfigmasterReloadersnap-core-0.9.4.1Snap.Internal.Types MonadSnap lens-3.9.1Control.Lens.TH makeLenses runPureBase bracketSnap!MonadCatchIO-transformers-0.3.0.0Control.Monad.CatchIObracketGHC.Basefail finishWith$fMonadReadervHandler$fMonadStatevHandler _scAncestry _scFilePath_scId_scDescription _scUserConfig_scRouteContext_snapletConfig _snapletValuereloader scAncestry scDescription scFilePathscIdscRouteContextscRoutePattern scUserConfig _isTopLevel_cleanup _initMessages _environmentsnapletModifier $fMonoidHook$fMonadSnapletHandlercleanup curConfig environmenthFilterhandlers initMessages isTopLevel$fMonadSnapletInitializeriGet mtl-2.1.2Control.Monad.State.ClassgetiModifymodifyiGetsgets toSnapletHookupHookupHook' modifyCfgsetupFilesystem mkSnaplet bracketInitsetupSnapletCallchroot chrootHandler mkReloaderrunBaserunInitializerloadAppConfig'addPostInitHook' mungeFilter logInitMsgrunInitializer'snap-server-0.9.3.4 Snap.Internal.Http.Server.ConfigConfig isSnapletsDirisDirisCfggetCfg gHeistInitheistInitWorker finalLoadHookRunning _masterConfig _heistState _heistCTS_defMode Configuring _heistConfigdefModeheistCTS heistConfig heistState masterConfig iRenderHelper cRenderHelper$fMonadSnapHeistT changeStateserveURI heist-0.13.0 Heist.Types HeistStatedefaultStrength$fFromJSONRole $fToJSONRole$fFromJSONPassword$fToJSONPassword$fFromJSONAuthUser$fToJSONAuthUser$fShowAuthFailure loadSession buildAuthUser$fIAuthBackendAuthManagersetSessionUserIdremoveSessionUserIdgetSessionUserId cacheOrLookupmodPasswordResetTokengetRememberTokensetRememberTokenforgetRememberToken loginUser' cIfLoggedIn cIfLoggedOut cLoggedInUser UserCacheuidCache loginCache tokenCache uidCounterJsonFileAuthManagermemcachedbfileRemTokenUserCacheLoginUserCache UserIdCache defUserCache loadUserCache jsonFileSave withCachegetUsershowT$fFromJSONUserCache$fToJSONUserCache!$fIAuthBackendJsonFileAuthManager $fFromJSONMap $fToJSONMapPayloadCookieSessionManager cookieNametimeOutunordered-containers-0.2.3.2Data.HashMap.BaseHashMap getPayload setPayload csCSRFToken csSession encodeTuple decodeTuplemkCookieSessionloadDefSession modSession%$fISessionManagerCookieSessionManager$fSerializeCookieSessionremoveFileMayNotExist!Snap.Internal.Test.RequestBuilderRequestBuilderSnap.Internal.Http.TypesResponse getSnaplet>>=>>fmapreturnControl.Monad.Fixmfix Control.MonadguardliftMMonadFunctorMonadFix MonadPlusControl.Applicative Applicative<*> Data.Functor<$><**> AlternativemplusmzerooptionalliftA3liftA2liftA<**>puremanysome<|>getConstConst unwrapMonad WrapMonad WrappedMonad unwrapArrow WrapArrow WrappedArrow getZipListZipList Data.FunctionfixmfilterapliftM5liftM4liftM3liftM2unlesswhen replicateM_ replicateMfoldM_foldM zipWithM_zipWithM mapAndUnzipMjoinvoidforever<=<>=>msumforM_forMfilterMmapM_mapM sequence_sequence=<<<$transformers-0.3.0.0Control.Monad.Trans.State.Lazy evalStateT runStateTenumerator-0.4.19Data.Enumerator.Internal EnumeratorControl.Monad.Trans.ClassliftputrunStatestateState MonadStateControl.Lens.LoupeLoupe SimpleLoupeControl.Lens.Lens<#=<#~#%%=<#%=<#%~#%=#=#%%~#%~#~storing^# cloneLensALensALens'Control.Monad.IO.ClassliftIOMonadIO MonadTransStateT evalState execStatemapState withState execStateT mapStateT withStateTSnap.Internal.Routing routeLocalroutegetTimeoutModifiergetTimeoutAction modifyTimeout extendTimeout setTimeout expireCookie readCookie getCookiegetQueryParams getPostParams getParams getQueryParam getPostParamgetParamrunSnap escapeHttpterminateConnectionipHeaderFilter'ipHeaderFilter withResponse withRequest localRequestsendFilePartialsendFile writeLazyText writeTextwriteLBSwriteBS writeBuilder addToOutputlogError redirect'redirectmodifyResponse modifyRequest putRequest putResponse getsResponse getResponse getsRequest getRequestifToppathArgpathdirmethodsmethodpasscatchFinishWithtransformRequestBodyreadRequestBodygetRequestBodyrunRequestBodyliftSnapNoHandlerExceptionSnap.Internal.ExceptionsEscapeHttpHandlerSnap.Internal.ParsingprintUrlEncodedbuildUrlEncodedparseUrlEncodedurlEncodeBuilder urlEncode urlDecode parseHttpTimeformatHttpTimesetBufferingModegetBufferingModeclearContentLengthsetContentLengthmodifyResponseCookiedeleteResponseCookiegetResponseCookiesgetResponseCookieaddResponseCookiesetContentTypemodifyResponseBodysetResponseCodesetResponseStatussetResponseBody emptyResponse rqSetParamrqModifyParams rqQueryParam rqPostParamrqParam deleteHeader listHeaders getHeader getHeaders setHeader addHeaderheaders updateHeaders HasHeadersGETHEADPOSTPUTDELETETRACEOPTIONSCONNECTPATCHMethod HttpVersioncookieHttpOnly cookieSecure cookiePath cookieDomain cookieExpires cookieValueCookieParamsSomeEnumerator rqPostParams rqQueryParamsrqParams rqQueryStringrqURI rqContextPath rqPathInfo rqCookies rqVersionrqMethodrqContentLength rqIsSecurerqLocalHostname rqLocalAddr rqRemotePort rqRemoteAddr rqServerPort rqServerNameRequestrspStatusReason rspStatusSnap.Types.HeadersHeadersSnap.Http.ServersetUnicodeLocalequickHttpServe httpServesimpleHttpServesnapServerVersionfmapOptextendedCommandLineConfigcommandLineConfig optDescrscompleteConfiggetStartupConfiggetStartupSocketssetStartupHook setProxyTypesetOthersetDefaultTimeoutsetErrorHandler setVerbosesetCompression setSSLKey setSSLCert setSSLBind setSSLPortsetBindsetPort setLocale setErrorLog setAccessLog setHostnamegetStartupHook getProxyTypegetOthergetDefaultTimeoutgetErrorHandler getVerbosegetCompression getSSLKey getSSLCert getSSLBind getSSLPortgetBindgetPort getLocale getErrorLog getAccessLog getHostname emptyConfig ConfigNoLog ConfigFileLog ConfigIoLog ConfigLog StartupInfo