Commit Graph

406 Commits

Author SHA1 Message Date
Alex Kardos
76fc5887f9 Fixed registerHandler CSRF issue
The default register handler for email authentication didn't provide a
CSRF token. I provided one by using a monadic form helper.
2016-02-17 20:39:09 -07:00
Maximilian Tagher
d39ce44c21 Use defaultCsrfParamName instead of hard-coding its value
* Up version bounds so that `defaultCsrfParamName` is available.
* I didn't bump the yesod-form version. It seemed unnecessary to do a new release just for this.
2016-02-15 23:59:24 -08:00
Maximilian Tagher
a01051eaf6 Have the yesod-auth login form use a CSRF token
Closes #1159

Based on reading this [StackOverflow Post](http://stackoverflow.com/questions/6412813/do-login-forms-need-tokens-against-csrf-attacks) and skimming [this paper](http://seclab.stanford.edu/websec/csrf/csrf.pdf), using CSRF protection on login forms protects against a vulnerability where an attacker submits their own username/password in the login form. Later, the user uses the real site, but doesn't realize they're logged in as the attacker. This creates vulnerabilities like:

1. If the site logs the user's activity for them (e.g. recently watched videos on YouTube, previous searches on Google), the attacker can see this information by logging in.
2. The user adds sensitive information to the account, like credit card information, the attacker can login and potentially steal that information or use it on the site.

I don't think this vulnerability applies to the `Yesod.Auth.Hardcoded` plugin because the attacker couldn't create an account of their own.

However:

* If I understand the example in `Yesod.Auth.Hardcoded`, one use case is to share one login form that works for both the Hardcoded plugin as well as normal database-backed username/password login, in which case having a CSRF token makes sense
* I don't see a downside to having the CSRF token there
* It makes the Hardcoded plugin work with the CSRF middleware

Does this sound like the right solution?
2016-02-14 17:32:46 -08:00
Eric Easley
4bc4fc3b36 Adjust yesod-auth for split DB 2016-02-07 19:17:50 -08:00
Eugen
69b4751990 Fix typo in auth german translation 2016-01-26 00:12:26 +01:00
Michael Snoyman
df90bd43e2 Deprecate Yesod.Auth.GoogleEmail #1150 2016-01-21 09:00:50 +02:00
vlatkoB
1fca3ceea3 Croatian translation 2016-01-20 08:48:15 +01:00
mrkkrp
1976e90be9 Bump password strength to compensate 2 years
Computers are now faster than in 2013.
2015-12-03 00:08:51 +06:00
mrkkrp
2431100c8b Fix a typo 2015-12-03 00:08:40 +06:00
Greg Weber
dae434aa64 release Yesod.Auth.HardCoded 2015-11-29 17:27:41 -08:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
4f2f49b5ee Update documention
More concrete module documentation.  Now it shows a way to combine
'AuthHardcoded' plugin with other plugins.

Fixed some typos.
2015-11-29 22:12:40 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
f524ce55ea Bump minor version of yesod-auth 2015-11-29 22:12:40 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
b024a7a540 Add module documentation 2015-11-29 22:12:40 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
9fbc3bc082 Initial module implementation 2015-11-29 22:12:40 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
ec3ec15a80 Fix Czech UserName message
Convert word "jméno" to lowercase.
See comment from
[`lubomir`](https://github.com/yesodweb/yesod/pull/1100#commitcomment-14580304)
2015-11-24 13:34:13 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
a6494bf788 Bump minor version 2015-11-24 02:19:04 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
97d8bbba06 Introduce LogoutTitle message constructor
`LogoutTitle` is a replacement for `Logout` constructor, the latter is
inconsistent with `LoginTitle` constructor name.
Added `DEPRECATED` pragma to warn users about this change.
2015-11-24 02:15:03 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
11bedecdc0 Prettify imports (via Stylish Haskell) 2015-11-23 16:41:09 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
d1e92af79e Add UserName message constructor 2015-11-23 16:40:47 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
311f949f0e Extract "in"/"out" suffixes in Login/Logout words
Split "Login" and "Logout" words into two parts, e.g. "Log In" and "Log
Out".
2015-11-23 16:14:40 +05:00
Paul Rouse
276e687ac5 Example loginHandler override in haddock 2015-10-27 11:50:27 +00:00
Paul Rouse
a25153d86e Provide default loginHandler as separate function 2015-10-21 12:27:59 +01:00
Michael Snoyman
5d0a4567f3 Add the guessApproot function (pinging @gregwebs) 2015-10-13 10:32:25 +00:00
Michael Snoyman
2179a8e30d GoogleEmail2: proper error message when permission denied 2015-10-13 08:02:19 +00:00
Michael Snoyman
e2e2edf270 Fix openid.hs 2015-10-13 07:41:49 +00:00
Greg Weber
3f96cae289 yesod-auth: add a runHttpRequest typeclass method 2015-10-07 07:06:21 -07:00
Greg Weber
92870f8c47 version bump 2015-09-10 16:18:36 -07:00
Greg Weber
6a567f0ccd ask for profile permission
somehow we are able to read the profile
of most users without this
2015-09-10 15:57:01 -07:00
Michael Snoyman
aff47075b2 Update changelog 2015-06-30 06:49:17 +03:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
4ba82fad96 Version bump 2015-06-24 20:54:27 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
2074915962 Apply stylish-haskell, organize imports 2015-06-24 20:54:27 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
dfd14ea16d Remove redundant imports 2015-06-24 20:54:27 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
1891e573fc Use nonce package in Auth.GoogleEmail2
Generate CSRF tokens using `nonce` package
2015-06-24 20:54:20 +05:00
Arthur Fayzrakhmanov (Артур Файзрахманов)
4b05cd83f6 Use nonce package in Auth.Email
Generate verification keys using `nonce` package.
2015-06-24 20:54:11 +05:00
Michael Snoyman
524297dafc persistent 2.2 2015-06-14 13:32:40 +03:00
Jude Taylor
886e6bdd2c add ConstrainedClassMethods 2015-06-08 00:30:16 -07:00
Michael Snoyman
fa0fbb4569 Version bump 2015-04-26 18:37:33 +03:00
Richard Zetterberg
9e1516594e Fixes faulty type annotations 2015-04-26 15:28:45 +02:00
Richard Zetterberg
770a7a29d2 Adds export of verify route
This allows users of the library to easily render VerUrl to use in
verification emails to new users, if the user was created outside
of the regular register functionality.
2015-04-26 14:55:12 +02:00
Alexander Bondarenko
5cc440129d Provide a hint on how to use loginHandler. 2015-04-24 12:11:10 +03:00
Michael Snoyman
e3e5cb80eb A bit more version bumping 2015-03-24 08:54:09 +02:00
patrick brisbin
cb27424083
Version bump to 1.4.4 2015-03-23 18:01:26 -04:00
patrick brisbin
3564e1f746
Add AuthenticationResult and authenticate function
- getAuthId returns Maybe AuthId with no useful information in the
  Nothing case.
- AuthenticationResult includes whether it was a User or Server error
  (with an accompanying message) in the failure case.
- User errors are displayed back to the user and have a 401 status in
  JSON responses. Server errors are logged and a generic error message
  is presented to the user, with a 500 status in JSON responses.

Resolves #956
2015-03-23 18:01:26 -04:00
Michael Snoyman
c7b4f1ddbe Version bump 2015-02-24 18:38:54 +02:00
Joel Taylor
dbd5fbfea2 add pragmas 2015-02-22 17:18:13 -08:00
Michael Snoyman
d82d3843b4 Version bump 2015-02-19 08:33:41 +02:00
Konstantin Zudov
18a8513e38 Save the access_token only from special handler 2015-02-16 14:16:26 +02:00
Konstantin Zudov
7ed5d4ad39 Added means to fetch user's Google profile
The existing GoogleEmail2 auth did that:
  - Acquire user access token with offline access
  - Use token to acquire user's profile
  - Build `Creds` with user's email as `ident` and the other profile
    details as stringy key-value pairs in `credsExtra`

This wasn't enough for me, for several reasons:
  - Access token was not saved after authentication. If we request 'offline'
    token why not to have a way of using it later.
  - Stringy key-value profile is not nice and `credsExtra` can be accessed
    only from `getAuthId`
  - I might want to request the profile after authentication process

So I've added the needed features.
  - The access token is saved in a session
  - There is a `Person` type with `FromJSON` instance and `getPerson`
    can be used to acquire it from `HandlerT`
2015-02-16 09:44:13 +02:00
Michael Snoyman
f1103a2bd6 Version bump 2015-02-08 07:17:55 +02:00
Aleksey Uimanov
e64773cd41 Perform onLogout before session cleaning 2015-02-05 00:21:14 +05:00
Michael Snoyman
9a3a2a5aa5 Version bump 2015-01-09 11:04:18 +02:00
Félix Sipma
9c1a970305 Updated french translation of Yesod.Auth.Message. 2015-01-07 19:40:37 +01:00
Michael Snoyman
e96d1c3622 Version bumps 2014-12-30 05:58:39 +02:00
gxtaillon
c9dff10bd1 Updated french translation of Yesod.Auth.Message. 2014-12-28 00:51:43 -05:00
Артур Файзрахманов
7875b6aa87 Support "Logout" message
Added support for `Logout` message, all translations made with Google
Translate, except: Russian translation (by hand) and Dutch translation
(do not translated)
2014-12-22 01:19:47 +05:00
Michael Snoyman
bed6dafce8 Doc link updates 2014-12-21 15:23:52 +02:00
Michael Snoyman
a0836cf955 Version bump 2014-11-20 02:18:44 +02:00
Mats Rietdijk
0678281352 Adds missing dutch translation and improved another translation 2014-11-19 23:02:35 +01:00
Mats Rietdijk
31fb28850c Adds dutch translations to yesod-auth 2014-11-19 22:47:32 +01:00
Michael Snoyman
94491f6417 Version bump 2014-10-23 05:59:32 +03:00
Paul Rouse
fbb0313589 Redirect dynamically in GoogleEmail2 login page 2014-10-21 09:09:34 +01:00
Michael Snoyman
c91b2978be Remove deprecated deps 2014-10-01 07:09:39 +03:00
Michael Snoyman
9ce4d49d0a persistent 2.1 and warp 3.0.2 2014-09-30 06:57:38 +03:00
Greg Weber
510f70d5b3 fix typos 2014-09-24 08:07:15 -07:00
Greg Weber
01339ad528 add some documentation for Yesod.Auth.Email 2014-09-24 07:47:13 -07:00
Michael Snoyman
def48d8a45 Version bumps for 1.4 release 2014-09-21 11:41:37 +03:00
Michael Snoyman
f86d181377 Merge branch 'master' into yesod-1.4 2014-09-21 00:07:11 +03:00
Greg Weber
629df4a291 add required attribute 2014-09-17 12:31:42 -07:00
Greg Weber
17b94c16c7 version bump 2014-09-17 09:28:45 -07:00
Greg Weber
8c2542eb8c add required attribute 2014-09-17 09:28:26 -07:00
Greg Weber
51927638c1 version bump 2014-09-16 18:50:06 -07:00
Greg Weber
448b33d1cc fix confirmation email status
I screwed this up in a big re-factoring in 153654ad
2014-09-16 18:49:45 -07:00
Greg Weber
4f95cb9f64 Merge pull request #825 from yesodweb/confirm-email-status
Confirm email status
2014-09-16 20:49:05 -05:00
Greg Weber
2a30519169 fix some import warnings 2014-09-16 18:13:28 -07:00
Greg Weber
1067816b5d fix confirmation email status
I screwed this up in a big re-factoring in 153654ad
2014-09-16 18:10:40 -07:00
Michael Snoyman
50f57a3586 Fix browserid.hs (closes #547) 2014-09-14 11:04:16 +03:00
Manuel Gómez
94331fcab9 Travis doesn't like type instance in a class 2014-09-12 13:35:00 +00:00
Manuel Gómez
9729cd9d15 Default type instance for AuthEntity
`AuthEntity` is now a type family associated to the `YesodAuthPersist`
class, so its old type alias definition has now become its default type
instance, which allows recovering the old behavior with minimal
boilerplate: an empty instance declaration for `YesodAuthPersist` makes
a Yesod application written with Persistent work just like before.

Unfortunately, this requires enabling `UndecidableInstances` in the
`Yesod.Auth` module since there is now a nested type family application
(as `AuthEntity` is now itself a type family).

This was tested with the scaffolded application with PostgreSQL, and it
works (given another small change to make it work with Persistent 2 due
to how `SqlPersistT` is now defined).
2014-09-12 13:18:51 +00:00
Manuel Gómez
4fd20299c1 maybeAuthPair, requireAuthPair
`maybeAuth` and `requireAuth` have been reverted to their original
signatures, which assume a Persistent database.  `maybeAuthPair` and
`requireAuthPair` are introduced, which do the same but without that
assumption.
2014-09-12 13:14:15 +00:00
Greg Weber
ec6fd486b6 remove the id_token parameter
We saw this error:
Internal Server Error
key "id_token" not present
2014-09-11 13:19:20 -07:00
Manuel Gómez
086837686a Decouple YesodAuthPersist from Persistent 2014-09-10 17:51:11 +00:00
Michael Snoyman
2b01c38d60 Added missing pragma 2014-09-08 07:11:38 +03:00
Michael Snoyman
ccab062f2d Remove all conditional compilation for Yesod 1.4 release
Left in for GHC-bundled libraries (ghc, base, bytestring, binary)
2014-09-07 18:17:45 +03:00
Michael Snoyman
9471399589 Merge branch 'master' into yesod-1.4 2014-08-28 05:19:21 +03:00
Michael Snoyman
d6b3d2a890 conduit 1.2 version bumps 2014-08-27 18:01:02 +03:00
Michael Snoyman
8b2297adf4 Conditional support for persistent2 branch.
Pinging @gregwebs. I've backported the relevant tweaks on the yesod-1.4
branch, to allow master to compile against persistent2. Whenever you're
ready to release persistent2, we can:

1. Release persistent2.
2. Release new versions of yesod packages, which will work with
   persistent 1.3 and 2.0.
3. Add an upper bound in Stackage to avoid using the new persistent
   libraries until they're ready for primetime.
4. Release your blog post.

yesod-1.4 should then remove the CPP here and only work with
persistent2; the biggest "breaking change" in the 1.4 release will be
remove backwards compatibility hacks for persistent, conduit,
shakespeare, and wai.
2014-08-27 11:16:08 +03:00
Michael Snoyman
30352f56ec Some fixes for persistent2 2014-08-27 10:53:17 +03:00
Michael Snoyman
c66ef04f17 Merge branch 'master' into yesod-1.4
Conflicts:
	yesod-form/Yesod/Form/Functions.hs
2014-08-25 20:20:16 +03:00
cosmo0920
1f20cc0004 yesod-auth: bump up lower bound for aeson
Because `Data.Aeson.Encode.encodeToTextBuilder` is added since
aeson-0.7.0.0.
2014-08-24 19:55:19 +09:00
Michael Snoyman
2ad3227776 Version bumps 2014-08-20 17:54:46 +03:00
Michael Snoyman
17016f8427 Merge branch 'master' of github.com:yesodweb/yesod 2014-08-20 16:46:21 +03:00
Michael Snoyman
587080dbff Merge pull request #797 from wuzzeb/master
Include google person information in the credsExtra field for GoogleEmail2 auth
2014-08-17 11:20:29 +03:00
Michael Snoyman
a70de71d8e Merge branch 'master' of github.com:yesodweb/yesod 2014-08-16 23:06:29 +03:00
Michael Snoyman
63e7cd8e2f network/network-uri split (again) 2014-08-16 23:05:10 +03:00
John Lenz
2a6956a85c Small fixes to adding person info to creds extra for google auth 2014-08-15 21:17:52 -05:00
Kadzuya OKAMOTO
1fe72e8351 fixed Japanese message 2014-08-15 12:57:39 +09:00
John Lenz
8cc1accc11 Include google person information in the credsExtra field for GoogleEmail2 auth 2014-08-05 22:46:55 -05:00
Michael Snoyman
0a619bf29a Version bump 2014-08-03 16:23:16 +03:00
Michael Snoyman
4fd1f76b17 Merge pull request #792 from geraldus/auth-minor-improvements
pre-baked Route Auth value
2014-08-03 13:09:35 +03:00
Артур Файзрахманов
ed53d46adc Type signature fix 2014-08-03 16:07:16 +06:00