britton-jb / sentinel

DEPRECATED - Phoenix Authentication library that wraps Guardian for extra functionality
MIT License
106 stars 19 forks source link

Token Customization #55

Open sgeos opened 6 years ago

sgeos commented 6 years ago

Guardian.Plug.sign_in(user) calls appear in a number of places in few files. As of now, there does not appear to be a way to add permissions or otherwise customize generated tokens.

Maybe a solution would be factoring these calls out into something like a TokenMint module?

defmodule TokenMint do
  def sign_in(conn, user), do: Guardian.Plug.sign_in(conn, user)
end

A configuration option could be used to replace this with a user supplied module/function/plug that takes the user and uses it to mint a customized token. Would this be a reasonable way of issuing customized tokens in Sentinel?

britton-jb commented 6 years ago

@sgeos have you looked at Guardian 1.0? I believe you're talking about token customization as described there? I'm interested in including that kind of functionality, I just want to make sure I understand it fully enough to do a compatible implementation well.