ueberauth / guardian_backdoor

A plug to write faster acceptance tests by skipping the sign-in process. This feature is inspired by Clearance’s backdoor.
MIT License
26 stars 5 forks source link

Support passing claims directly to backdoor #4

Closed jayjun closed 6 years ago

jayjun commented 6 years ago

Rather than generate a token, pass claims directly through query strings. Passing

/?claims[sub]=User:1&claims[foo]=bar

is equivalent to signing in with

%{"sub" => "User:1", "foo" => "bar"} = claims

This allows claims to be tailored exactly to testing needs, and avoids side effects from having to generate a token from MyApp.Guardian.encode_and_sign(resource).