Attributes
- Companion
- class
- Source
- Guard.scala
- Graph
-
- Supertypes
- Self type
-
Guard.type
Members list
Value members
Concrete methods
A guard over U.
A guard over U.
credentials answers with the key and the stored hash of the row that email names. A lookup that has returned its pair has finished, so the hashing happens after whatever the lookup held is let go: an application reading from a pool, as examples/blog does, is no longer holding a connection while bcrypt runs. That is what the shape gives and the whole of it. A credentials that handed back a pair from inside a scope it had not closed, or one whose second element is only computed when read, would still be holding it, and no signature can say otherwise.
login defaults to a mounted /login, which is what makes the common case one line and the mounted case correct: a Url.Mounted is rewritten by Route.under's response wrapper, so a guard under /admin redirects to /admin/login and the login route it carries answers there. A plain String here would 404 the moment anything was mounted.
home is where a sign in that was not preceded by a refusal lands, and it defaults to the mount root only because a guard cannot guess which of an application's routes is the one a signed in user wants. An application that mounts nothing at its root, which is the ordinary shape once anything is guarded, sets home to the page it does mount, the same way Post's declaration is the only place that names /posts.
lifetime is how long a sign in lasts, counted from the moment it was made and not refreshed by use. A parameter with a default rather than an HttpApp override or an environment variable, because how long a sign in should last is a property of the thing being guarded: an admin area and a blog want different answers, and an application with two guards would have no way to say so through one setting.
clock exists so that a suite can ask what happens after a fortnight without waiting one. It is read only where a sign in is stamped and where its age is measured, so passing one changes nothing else, and the default is the system clock in UTC.
Attributes
- Source
- Guard.scala
Concrete fields
How long a sign in lasts when an application says nothing.
How long a sign in lasts when an application says nothing.
Two weeks is long enough that a person using an application most days is never asked again, and short enough that a laptop left in a taxi stops being a way in within a fortnight.
Attributes
- Source
- Guard.scala