View Source PowAssent.Plug.Reauthorization (PowAssent v0.4.18)
This plug can reauthorize a user who signed in through a provider.
The plug is dependent on a :handler that has the following methods:
reauthorize?/2- verifies the request for reauthorization condition. If the condition exists for the request (usually the sign in path), the reauthorization cookie will be fetched and deleted, thereauthorize/2callback will be called, and the connection halted.clear_reauthorization?/2- verifies the request for clear reauthorization condition. If the condition exists (usually the session delete path) then the cookie is deleted.reauthorize/3- the callback to handle the request when a reauthorization condition exists. Usually this would redirect the user.
See PowAssent.Phoenix.ReauthorizationPlugHandler for a Phoenix example.
Example
plug PowAssent.Plug.Reauthorization,
handler: MyApp.ReauthorizationHandlerConfiguration options
:handler- the handler module. Should either be a module or a tuple{module, options}.:reauthorization_cookie_key- reauthorization key name. This defaults to "authorization_provider". If:otp_appis used it'll automatically prepend the key with the:otp_appvalue.:reauthorization_cookie_opts- keyword list of cookie options, seePlug.Conn.put_resp_cookie/4for options. The default options are[max_age: max_age, path: "/"]where:max_ageis 30 days.