Charon.TokenPlugs.PutAssigns (Charon v4.2.0)
View SourceAfter verifying everything you would want to verify about a token, assign data to the conn.
The following is assigned by default:
:user_id(bearer token claim "sub"):session_id(bearer token claim "sid"):token_payload:session(if fetched withCharon.TokenPlugs.load_session/2)
All of the assign names are overridable:
# assign the user ID to key :current_user_id
plug PutAssigns, claims: %{"sub" => :current_user_id, "sid" => :session_id}This plug is skipped if an authentication error is present.