New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

warden-ocra

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

warden-ocra

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

Warden::Ocra

Warden strategy for OCRA: OATH Challenge-Response Algorithm (rfc 6287)

Installation

Add this line to your application's Gemfile:

gem 'warden-ocra'

And then execute:

$ bundle

Or install it yourself as:

$ gem install warden-ocra

Usage

The authentication requires two steps:

  1. post a user identifier (e.g. email address) this generates the challenge for that user, no authentication is performed
  2. post the user and the answer to the challenge this actually authenticates the user

Sinatra sample setup

See the spec sample sinatra app for more details.

use Rack::Session::Cookie
use Warden::Manager do |config|
  config.default_strategies :ocra_verify, :ocra_challenge
  config.failure_app = YourApp
end
# step 1
post '/generate_challenge' do
  env["warden"].authenticate!
  # generates env["warden"].user.challenge
end

# step 2
post '/login' do
  env["warden"].authenticate!
  # performs the actual authentication
end

A User class is assumed to have the following methods. The user class and its method names can be configured if your model has different methods.

  • User.find_by_email!(email)
  • User.has_challenge?(email)
  • User.generate_challenge!(email)
  • User#shared_secret
  • User#challenge

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

FAQs

Package last updated on 29 May 2013

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