lib/rodauth/features/oauth_jwt.rb in rodauth-oauth-1.4.0 vs lib/rodauth/features/oauth_jwt.rb in rodauth-oauth-1.5.0
- old
+ new
@@ -48,26 +48,25 @@
def authorization_token
return super unless oauth_jwt_access_tokens
return @authorization_token if defined?(@authorization_token)
- @authorization_token = begin
- access_token = fetch_access_token
+ @authorization_token = decode_access_token
+ end
- return unless access_token
+ def decode_access_token(access_token = fetch_access_token)
+ return unless access_token
- jwt_claims = jwt_decode(access_token)
+ jwt_claims = jwt_decode(access_token)
- return unless jwt_claims
+ return unless jwt_claims
- return unless jwt_claims["sub"]
+ return unless jwt_claims["sub"]
- return unless jwt_claims["aud"]
+ return unless jwt_claims["aud"]
- jwt_claims
- end
+ jwt_claims
end
-
# /token
def create_token_from_token(_grant, update_params)
oauth_grant = super