class GrapeSimpleAuth::AuthStrategies::Swagger

Public Instance Methods

auth_scopes() click to toggle source
# File lib/grape_simple_auth/auth_strategies/swagger.rb, line 17
def auth_scopes
  if optional_endpoint?
    optional_oauth2.map { |hash| hash[:scope].to_sym }
  else
    authorization_type_oauth2.map { |hash| hash[:scope].to_sym }
  end
end
endpoint_protected?() click to toggle source
# File lib/grape_simple_auth/auth_strategies/swagger.rb, line 9
def endpoint_protected?
  has_authorizations? && !!authorization_type_oauth2
end
has_auth_scopes?() click to toggle source
# File lib/grape_simple_auth/auth_strategies/swagger.rb, line 13
def has_auth_scopes?
  endpoint_protected? && !authorization_type_oauth2.empty?
end
optional_endpoint?() click to toggle source
# File lib/grape_simple_auth/auth_strategies/swagger.rb, line 5
def optional_endpoint?
  has_authorizations? && !!optional_oauth2
end

Private Instance Methods

authorization_type_oauth2() click to toggle source
# File lib/grape_simple_auth/auth_strategies/swagger.rb, line 35
def authorization_type_oauth2
  endpoint_authorizations[:oauth2]
end
endpoint_authorizations() click to toggle source
# File lib/grape_simple_auth/auth_strategies/swagger.rb, line 31
def endpoint_authorizations
   api_context.options[:route_options][:authorizations]
end
has_authorizations?() click to toggle source
# File lib/grape_simple_auth/auth_strategies/swagger.rb, line 27
def has_authorizations?
  !!endpoint_authorizations
end
optional_oauth2() click to toggle source
# File lib/grape_simple_auth/auth_strategies/swagger.rb, line 39
def optional_oauth2
  endpoint_authorizations[:optional_oauth2]
end