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

openid_config_parser

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openid_config_parser

  • 0.2.3
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

OpenidConfigParser

openid_config_parser is a lightweight Rubygem containing a method that fetches and parses OpenID Connect configuration data from a specified endpoint URL and returns a Hash object. It includes error handling to manage various issues that might occur during the HTTP request and JSON parsing process.

Installation

To install the gem run the following command in the terminal:

$ bundle add openid_config_parser

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install openid_config_parser

Usage

For non-Rails application you might need to require the gem in your file like so:

require 'openid_config_parser'

You can use the openid_config_parser in any of your Rails controllers, models, or other parts of your application.

# app/controllers/application_controller.rb

class ApplicationController < ActionController::Base
  def fetch_openid_config
    endpoint = "https://example.com/.well-known/openid-configuration"
    config = OpenidConfigParser.fetch_openid_configuration(endpoint)

    if config
      issuer = config.issuer # or config[:issuer]
      auth_endpoint = config.authorization_endpoint # or config[:authorization_endpoint]
      token_endpoint = config.token_endpoint # or config[:token_endpoint]
      jwks_uri = config.jwks_uri # or config[:jwks_uri]
      userinfo_endpoint = config.userinfo_endpoint # or config[:userinfo_endpoint]
      # and so on
    else
      Rails.logger.error "Failed to fetch OpenID configuration"
    end
  rescue OpenidConfigParser::Error => e
    Rails.logger.error "Error fetching OpenID configuration: #{e.message}"
  end
end

Considering that HTTP request is made to fetch the endpoint configuration, you can call this method in a background job for optimized performance.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/msuliq/openid_config_parser. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

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

Code of Conduct

Everyone interacting in the OpenidConfigParser project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

FAQs

Package last updated on 16 Jun 2024

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