qarth.friend documentation
Friend workflows for Qarth.
auth-record
(auth-record req)
Looks for a qarth auth record in the Friend authentications.
Returns it, or nil if not found.
oauth-workflow
(oauth-workflow {:keys [service key auth-url credential-fn redirect-on-auth? login-url login-uri login-failure-handler], :as params})
Creates a Friend using a Qarth service.
Required arguments:
service -- the auth service
auth-url -- A dual purpose URL. This starts both the OAuth workflow
(so a login button, for example, should redirect here)
and serves as the auth callback.
It should be the same as the callback in your auth service.
Optional arguments:
login-url or login-uri -- a URL to redirect to if a user is not logged in.
(The default Friend :login-uri is /login.)
key -- for multi-services. Can also be passed as a query param, "service".
credential-fn -- override the Friend credential fn.
The default Friend credential-fn, for some reason, returns nil.
The credential map supplied is of the form
{::qarth.oauth/record auth-record, :identity ::qarth.oauth/anonymous}.
redirect-on-auth? -- the Friend redirect on auth setting, default true
login-failure-handler -- the login failure handler.
The default is to redirect to the configured login-url.
Failure also logs an exception and clears the current auth record.
Exceptions are logged and treated as auth failures.
requestor
(requestor req service)
Get an auth requestor from a Friend-authenticated request and a service.