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

omniauth_openid_connect_test

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

omniauth_openid_connect_test

  • 0.3.6
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

OmniAuth::OpenIDConnect

Originally was omniauth-openid-connect

I've forked this repository and launch as separate gem because maintaining of original was dropped.

Build Status

Installation

Add this line to your application's Gemfile:

gem 'omniauth_openid_connect'

And then execute:

$ bundle

Or install it yourself as:

$ gem install omniauth_openid_connect

Supported Ruby Versions

OmniAuth::OpenIDConnect is tested under 2.4, 2.5, 2.6, 2.7

Usage

Example configuration

config.omniauth :openid_connect, {
  name: :my_provider,
  scope: [:openid, :email, :profile, :address],
  response_type: :code,
  uid_field: "preferred_username",
  client_options: {
    port: 443,
    scheme: "https",
    host: "myprovider.com",
    identifier: ENV["OP_CLIENT_ID"],
    secret: ENV["OP_SECRET_KEY"],
    redirect_uri: "http://myapp.com/users/auth/openid_connect/callback",
  },
}

Options Overview

FieldDescriptionRequiredDefaultExample/Options
nameArbitrary string to identify connection and identify it from other openid_connect providersnoString: openid_connect:my_idp
issuerRoot url for the authorization serveryeshttps://myprovider.com
discoveryShould OpenID discovery be used. This is recommended if the IDP provides a discovery endpoint. See client config for how to manually enter discovered values.nofalseone of: true, false
client_auth_methodWhich authentication method to use to authenticate your app with the authorization servernoSym: basic"basic", "jwks"
scopeWhich OpenID scopes to include (:openid is always required)noArray [:openid][:openid, :profile, :email]
response_typeWhich OAuth2 response type to use with the authorization requestnoString: codeone of: 'code', 'id_token'
stateA value to be used for the OAuth2 state parameter on the authorization request. Can be a proc that generates a string.noRandom 16 character stringProc.new { SecureRandom.hex(32) }
response_modeThe response mode per specnonilone of: :query, :fragment, :form_post, :web_message
displayAn optional parameter to the authorization request to determine how the authorization and consent pagenonilone of: :page, :popup, :touch, :wap
promptAn optional parameter to the authrization request to determine what pages the user will be shownnonilone of: :none, :login, :consent, :select_account
send_scope_to_token_endpointShould the scope parameter be sent to the authorization token endpoint?notrueone of: true, false
post_logout_redirect_uriThe logout redirect uri to use per the session management draftnoemptyhttps://myapp.com/logout/callback
uid_fieldThe field of the user info response to be used as a unique idno'sub'"sub", "preferred_username"
client_optionsA hash of client options detailed in its own sectionyes

Client Config Options

These are the configuration options for the client_options hash of the configuration.

FieldDescriptionDefaultReplaced by discovery?
identifierThe OAuth2 client_id
secretThe OAuth2 client secret
redirect_uriThe OAuth2 authorization callback url in your app
schemeThe http scheme to usehttps
hostThe host of the authorization servernil
portThe port for the authorization server443
authorization_endpointThe authorize endpoint on the authorization server/authorizeyes
token_endpointThe token endpoint on the authorization server/tokenyes
userinfo_endpointThe user info endpoint on the authorization server/userinfoyes
jwks_uriThe jwks_uri on the authorization server/jwkyes
end_session_endpointThe url to call to log the user out at the authorization servernilyes

Additional Configuration Notes

  • name is arbitrary, I recommend using the name of your provider. The name configuration exists because you could be using multiple OpenID Connect providers in a single app.

NOTE: if you use this gem with Devise you should use :openid_connect name, or Devise would route to 'users/auth/:provider' rather than 'users/auth/openid_connect'

  • response_type tells the authorization server which grant type the application wants to use, currently, only :code (Authorization Code grant) and :id_token (Implicit grant) are valid.
  • If you want to pass state paramete by yourself. You can set Proc Object. e.g. state: Proc.new { SecureRandom.hex(32) }
  • nonce is optional. If don't want to pass "nonce" parameter to provider, You should specify false to send_nonce option. (default true)
  • Support for other client authentication methods. If don't specified :client_auth_method option, automatically set :basic.
  • Use "OpenID Connect Discovery", You should specify true to discovery option. (default false)
  • In "OpenID Connect Discovery", generally provider should have Webfinger endpoint. If provider does not have Webfinger endpoint, You can specify "Issuer" to option. e.g. issuer: "https://myprovider.com" It means to get configuration from "https://myprovider.com/.well-known/openid-configuration".
  • The uid is by default using the sub value from the user_info response, which in some applications is not the expected value. To avoid such limitations, the uid label can be configured by providing the omniauth uid_field option to a different label (i.e. preferred_username) that appears in the user_info details.
  • The issuer property should exactly match the provider's issuer link.
  • The response_mode option is optional and specifies how the result of the authorization request is formatted.
  • Some OpenID Connect providers require the scope attribute in requests to the token endpoint, even if this is not in the protocol specifications. In those cases, the send_scope_to_token_endpoint property can be used to add the attribute to the token request. Initial value is true, which means that the scope attribute is included by default.

For the full low down on OpenID Connect, please check out the spec.

Contributing

  1. Fork it ( http://github.com/m0n9oose/omniauth-openid-connect/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Cover your changes with tests and make sure they're green (bundle install && bundle exec rake test)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request

FAQs

Package last updated on 29 Aug 2021

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