lib/real_savvy/jwt/token.rb in real_savvy-0.0.5 vs lib/real_savvy/jwt/token.rb in real_savvy-0.0.6
- old
+ new
@@ -83,11 +83,11 @@
end
)
end
def scope_includes!(*scope_parts)
- scope_includes?(*scope_parts) || fail(JWTUnauthorized)
+ scope_includes?(*scope_parts) || fail(::RealSavvy::JWT::Unauthorized)
end
def self.verbs_matches(verb)
verb_index = SCOPE_VERBS.index(verb)
verb_index ? SCOPE_VERBS[verb_index..-1] : []
@@ -96,11 +96,11 @@
def for_site?
audience_is_site? && subject_is_site?
end
def for_site!
- for_site? || fail(JWTUnauthorized)
+ for_site? || fail(::RealSavvy::JWT::Unauthorized)
end
def for_user?
audience_is_site? && (subject_is_user? || subject_is_imposter?)
end
@@ -124,11 +124,11 @@
subject.respond_to?(:is_real_savvy_site?) &&
subject.is_real_savvy_site?
end
def for_user!
- for_user? || fail(JWTUnauthorized)
+ for_user? || fail(::RealSavvy::JWT::Unauthorized)
end
def valid?
claims && claims.length > 0 && (for_site? || for_user?) && self.class.validate_token(token)
end
@@ -147,10 +147,10 @@
self.class.public_key,
true,
algorithm: 'RS256',
).first
rescue ::JWT::DecodeError => e
- raise RealSavvy::JWT::BadCredentials.new(e.message)
+ raise ::RealSavvy::JWT::BadCredentials.new(e.message)
end
def retrieve_audience
@audience = self.class.retrieve_audience(claims) if claims
end