Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jwt_handler_ruby

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jwt_handler_ruby

  • 0.0.6
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

JwtHandlerRuby

Short description and motivation.

Usage

How to use my plugin. Gem has next methods: decode_user(jwt) - expects jwt with user and returns decoded payload(in our case user info). valid_jwt?(jwt) - expects jwt and checks if it is valid. Return true when it is valid, otherwise returns false

Gem adds next endpoints to your application: /logins which has next methods:

  • POST - expects {"jwt": <jwt_signed by UM private key>}. It checks if jwt is valid and if so, then save it to the cookies called 'jwt'. if jwt is not valid then it delete it from the cookies. When jwt was added to cookies than it will be sent with every request.

Installation

Add this line to your application's Gemfile:

gem 'jwt_handler_ruby'

And then execute:

$ bundle

Or install it yourself as:

$ gem install jwt_handler_ruby

Requirements

To use gem you should provide environment variable with UM public key called 'JWT_PUBLIC_KEY'. Also, in your routes.rb file you should specify where /login endpoint will be mount. Example:

 mount JwtHandlerRuby::Engine, at: '/'  

in this case gems '/login' endpoint will be mounted at: domain.com/logins. If you already have a '/login' endpoint you can isolate it by

 mount JwtHandlerRuby::Engine, at: '/some_path'  

Then gems /login endpoint will be mounted on domain.com/some_path/logins

Contributing

Contribution directions go here.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 15 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc