omniauth / omniauth-saml

A generic SAML strategy for OmniAuth
https://github.com/omniauth/omniauth-saml
Other
334 stars 208 forks source link

Issue: omniauth: (saml) Request phase initiated. #202

Closed ghost closed 3 years ago

ghost commented 3 years ago

Hello Team,

I am facing in login via SAML I have used the devise in my application. Below are the versions which I am using right now in my application

Ruby 2.7.2
Rails 5.1.4

Gems
  - devise (4.8.0)
  - omniauth (2.0.4)
  - omniauth-saml (2.0.0)

Below are the configurations which I did in the devise.rb file

config.omniauth :saml, ENV["SAML_APP_KEY"], ENV["SAML_APP_SECRET"]

config.omniauth :saml,
  idp_cert_fingerprint: ENV["SAML_APP_FINGERPRINT"],
  idp_sso_target_url: 'http://localhost:3000/users/auth/saml'

I have used the Auth0 for generating the APP key, secret, fingerprint, and other credentials. Is it ok or I need to use other platform to generate the keys?

And in user.rb model file also added the below line

devise :omniauthable, omniauth_providers: %i[saml]

Below is the link set in the application home page "Sign in with SAML"

    = link_to "Sign in with SAML", user_saml_omniauth_authorize_path, method: :post

But when I click on the "Sign in with SAML" link it shows me the below error message Not found. Authentication passthru.

I have researched a lot many things but did not find anything useful so can you please help me with this why I am getting this issue. Do I miss anything while configuration?

I have followed the steps which are mentioned in the omniauth-saml gem to devise. Please let me know if you need more details here!

Looking forward to your response!

@md5

ilikepi commented 3 years ago

Are you certain about the idp_sso_target_url value? This URL would normally point to the identity provider (IdP), where the user would enter their credentials. The value you have specified looks like a path within your application.

ghost commented 3 years ago

@ilikepi: Thanks for the response! Actually, the idp_sso_target_url would be the URL(Identity Provider Single Sign-On URL) provided by any identity provider (idP) for SAML weather its is OKTA/OneLogin/Auth0 any of this.

So just copy your SSO URL(Identity Provider Single Sign-On URL) given by the provider and paste its value as idp_sso_target_url in devise.rb file.

It's worked for me and star initiating the login request to the provider. Here I have used the OKTA as a provider!