Giter Site home page Giter Site logo

openmaize-phoenix's Introduction

Openmaize-phoenix

An example of using Openmaize authentication library in a Phoenix web application.

To see how Openmaize is called, see the config/dev.exs and web/router.ex files. In addition, see the web/controllers/admin_controller.ex file and the login and login_form templates to see how the login GET request is handled. It is not necessary to write any logic for the login POST request and the logout request as those are handled by Openmaize.

In the web/router.ex file, you will see that there are three Openmaize plugs being used: Openmaize.LoginoutCheck, Openmaize.Authenticate and Openmaize.Authorize.

Openmaize.LoginoutCheck checks to see if the path is for the login or logout page and then handles the login or logout process if necessary.

Openmaize.Authenticate authenticates the user using Json Web Tokens (JWTs) and sets the current_user variable, and so @current_user will be available in all of the templates. If there is no user, current_user will be set to nil.

Openmaize uses roles to offer finer-grained protection, and so the user model needs to have a role entry, as well as id and name.

openmaize-phoenix's People

Contributors

riverrun avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.