View Source EctoSessions.Session (Ecto Sessions v0.1.0)

Link to this section Summary

Functions

Session is an Ecto schema with

Retuns a new session without sensitive data: plaintext_auth_token is dropped.

Link to this section Functions

Link to this macro

__using__(opts)

View Source (macro)

Session is an Ecto schema with:

  • id: a unique identifier of the session. This should be used by your application for internal purposes (ex: references, logs, etc), and not exposed to the end user.

  • auth_token: Random hashed token (or not, acoording to the configuration).

  • plaintext_auth_token: A virtual field available ony upon Session creation. It contains an unhashed, plaintext, version of the auth_token.

  • data: any data that your aplication needs to store for this session. Ex: user id, device name or even ui theme.

  • Any other field defined under exra_fields. Ex: [ {:user_id, :string}, {:role, :string} ]

By default if you have used EctoSessions in your project, import it with: alias MyApp.EctoSessions.Session

Link to this function

clear_sensitive_data(session)

View Source

Retuns a new session without sensitive data: plaintext_auth_token is dropped.