omniauth-saml
omniauth-saml copied to clipboard
Base64 decoding of SAML Response fails decoding UTF8
After some mysterious Login Failures in our GitLab using omniauth saml i could identify the problem being the SAML response not being decoded properly.
Doing some more digging, i found this: http://blog.zachallett.com/base64-decode64-does-bad-things-if-you-are-expecting-utf-8-encoded-strings/
Lacking any Ruby skills at all, i blindly appended .force_encoding('UTF-8').encode
at this line in omniauth-saml-1.4.1/lib/omniauth/strategies/saml.rb :
response = (response =~ /^</) ? response : Base64.decode64(response)
Which fixed the problem for me.