-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log error on failed resource/create #181
Comments
Thanks for the suggestion! Can you add a little more clarity about what you'd like to see there? You can also define Devise.saml_update_resource_hook = Proc.new do |user, saml_response, auth_value|
# Copied from the default behavior: https://github.com/apokalipto/devise_saml_authenticatable/blob/09221d59e434bc947327e478a388013a70add4f7/lib/devise_saml_authenticatable.rb#L101
saml_response.attributes.resource_keys.each do |key|
user.send "#{key}=", saml_response.attribute_value_by_resource_key(key)
end
if (Devise.saml_use_subject)
user.send "#{Devise.saml_default_user_key}=", auth_value
end
user.save!
rescue => e
# Add additional logging here
raise e
end |
Ah okay I did not think about adding a rescue in the update hook, I think I'll go with that In terms of improvement, instead of just the message |
I'm affected by this rescue in a (probably) different manner. In Is there a better way to do what I am trying to do, or would this perspective change your view about rescuing everything there? Please let me know. Thanks! |
Can you clarify what you mean here? What is no longer working? |
@adamstegman, my apologies. I meant something like the following:
Since the errors will now be rescued by devise_saml_authenticatable/lib/devise_saml_authenticatable/model.rb Lines 71 to 74 in 09221d5
|
@neroleung Thanks for pointing that out. It seems like we need to revert #176. @luke-zhou if we do that, it will raise an exception instead of returning null. Would that behavior work in your use case? |
Speaking for us, yes it would... We were seeing infinite login loops when the user create failed silently and no idea what was going on. We'd very much like to see some explicit warnings, or preferably an outright error. We are now doing the |
@hlascelles, looking at both #176 and #144, it feels like certain kind of validations and/or errors were raised inside your Would the |
I have tried @adamstegman's suggestion on another issue and it works great: #182 (comment) My handler now looks like:
No need to extend the controller class. |
Hi there,
I'm working on adding SAML SSO support into our service provider and the lack of error during creating/updating a resource makes it nearly impossible to debug what is going on.
Could a log be added to this rescue
devise_saml_authenticatable/lib/devise_saml_authenticatable/model.rb
Lines 71 to 74 in 09221d5
The text was updated successfully, but these errors were encountered: