lib/osso/helpers/auth.rb in osso-0.0.3.18 vs lib/osso/helpers/auth.rb in osso-0.0.3.19

- old
+ new

@@ -23,37 +23,39 @@ halt 401 if request.post? redirect ENV['JWT_URL'] end + def internal_protected! + return if admin_authorized? + return if internal_authorized? + + redirect ENV['JWT_URL'] + end + + def admin_protected! + return true if admin_authorized? + + redirect ENV['JWT_URL'] + end + + private + def enterprise_authorized?(domain) decode(token) @current_user[:scope] == END_USER_SCOPE && @current_user[:email].split('@')[1] == domain rescue JWT::DecodeError false end - def internal_protected! - return if admin_authorized? - return if internal_authorized? - - redirect ENV['JWT_URL'] - end - def internal_authorized? decode(token) @current_user[:scope] == INTERNAL_SCOPE rescue JWT::DecodeError false - end - - def admin_protected! - return if admin_authorized? - - redirect ENV['JWT_URL'] end def admin_authorized? decode(token)