Code Monkey home page Code Monkey logo

wor-authentication's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wor-authentication's Issues

Nil entity in entity_custom_validation_value

When I redefine this method entity_custom_validation_value in my api controller, if the entity is nil, it's impossible to do anything like entity.some_value, because it throws 500.

Lost of generalization

I think that the gem was created to add Authentication to any model that we want to, but in the README you are always talking about Users which may mislead some persons, for example:

  • "User tracking and custom validations"
  • "Keeping track of users? Override..."
  • "Invalidating all tokens for a user? "

Change in README

def new_token_expiration_date
  (Time.zone.now + 2.days).to_i
end

def token_maximum_useful_date
  (Time.zone.now + 30.days).to_i
end

In the methods listed above I wouldn't use .to_i because if you use it, you are not returning dates, just an integer, and also I would use the from_now method, for example, 2.days.from_now

Wrong example in README

In the README file there is an example for authenticate_entity that is

# authentication_controller.rb
def authenticate_entity(params)
  user ||= User.find_by(email: params[:email])
  return nil unless user.present? && user.valid_password?(params[:password])
end

This method uses memoization when it shouldn't (in my opinion) and also returns nil always

Add a method to create an access token from a user

You should be able to do something like this:

Wor::Authentication::SessionsController.generate_access_token(User.first)

But it fails in the line 33 -> renew_id = token_renew_id, because token_renew_id is a method from: Wor::Authentication::Controller

We shall move this method inside Wor::Authentication::SessionsController, because it's the only place where it's used

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.