
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
warden_openid_bearer
Advanced tools
Warden strategy for authentication with OpenID-Connect bearer tokens.
This gem is like
the warden_openid_auth gem,
except that it only provides support for the very last step of
the OAuth code flow, i.e. when the resource server / relying party
(your Ruby Web app) validates and decodes the bearer token.
Use this gem if your client-side Web (or mobile) app will be taking care of the rest of the OAuth2 motions, such as redirecting (or opening a popup window) to the authentication server at login time, managing and refreshing tokens, doing all these unspeakable things with iframes, etc.
rails_warden gem into your applicationconfig/initializers/authentication.rb:
Rails.application.config.middleware.use RailsWarden::Manager do |manager|
  manager.default_strategies WardenOpenidBearer::Strategy.register!
  WardenOpenidBearer.configure do |oidc|
    oidc.openid_metadata_url = "https://example.com/.well-known/openid-configuration"
    oidc.scope = ["openid", "email"]
    oidc.redirect_uri = ["openid", "email"]
    # Optional — Explicit OpenID-Connect server certificate (e.g. for a development rig):
    oidc.openid_server_certificate = <<-CERT
-----BEGIN CERTIFICATE----- MIIDCTBLAHBLAHBLAH== -----END CERTIFICATE----- CERT end
 manager.failure_app = Proc.new { |_env|
   ['401', {'Content-Type' => 'application/json'}, [{ error: 'Unauthorized' }.to_json]]
 }
end
1. Access control must be explicitly added to your controllers, e.g.
```ruby
class MyController < ApplicationController
  before_action do
    authenticate!
  end
end
Subclassing WardenOpenidBearer::Strategy is the recommended way to
valid?, metadata_url and/or cache_timeout),user_of_claims).More details available in the rubydoc comments of
lib/warden_openid_bearer/strategy.rb.
Install the gem and add to the application's Gemfile by executing:
$ bundle add warden_openid_bearer
If bundler is not being used to manage dependencies, install the gem by executing:
$ gem install warden_openid_bearer
After checking out the Git repository, run bin/setup to install dependencies. Then, run bundle exec rake to run the test suite and linter checks. You can also run bin/console for an interactive prompt that will allow you to experiment.
The debugger gem is a development-time requirement (in the Gemfile). In order to activate it:
require "debug" in ./spec/spec_helper.rbdebugger somewhere in the source or test codeTo install this gem onto your local machine, run bundle exec rake install.
To release a new version:
master branch on GitHub, and that the tests are greenmaster branch in your working directoryversion.rbbundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.orgBug reports and pull requests are welcome on GitHub at https://github.com/epfl-si/warden_openid_bearer .
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that warden_openid_bearer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.