From 0801b72acdcf45cbee01dc57c202502089cb8d06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B0=D0=BF=D0=BE=D0=BD=D0=B5=D0=BD=D0=BA=D0=BE=20?= =?UTF-8?q?=D0=94=D0=B5=D0=BD=D0=B8=D1=81?= Date: Mon, 16 Sep 2019 13:02:22 +0300 Subject: [PATCH] jwt token decoding fix by https://auth0.com/docs/tokens/reference/jwt/jwt-structure and https://www.rfc-editor.org/rfc/rfc7519.txt paragraph 3 --- app/models/oic_session.rb | 4 ++-- overlays | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) create mode 120000 overlays diff --git a/app/models/oic_session.rb b/app/models/oic_session.rb index 045a123..27e0dcd 100644 --- a/app/models/oic_session.rb +++ b/app/models/oic_session.rb @@ -86,7 +86,7 @@ def refresh_access_token! def self.parse_token(token) jwt = token.split('.') - return JSON::parse(Base64::decode64(jwt[1])) + return JSON::parse(Base64::urlsafe_decode64(jwt[1])) end def claims @@ -143,7 +143,7 @@ def admin? def user if @user.blank? || id_token_changed? - @user = JSON::parse(Base64::decode64(id_token.split('.')[1])) + @user = JSON::parse(Base64::urlsafe_decode64(id_token.split('.')[1])) end return @user end diff --git a/overlays b/overlays new file mode 120000 index 0000000..d0bfb1b --- /dev/null +++ b/overlays @@ -0,0 +1 @@ +/overlays/redmine_openid_connect_github \ No newline at end of file