Class: CASServer::Authenticators::Helpers::Identity

Inherits:
ActiveResource::Base
  • Object
show all
Defined in:
lib/casserver/authenticators/active_resource.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.authenticate(credentials = {}) ⇒ Object

Autenticate an identity using the given method

Parameters:

  • credentials (Hash) (defaults to: {})


43
44
45
46
# File 'lib/casserver/authenticators/active_resource.rb', line 43

def self.authenticate(credentials = {})
  response = send(method_type, method_name, credentials)
  new.from_authentication_data(response)
end

.method_typeObject



31
32
33
# File 'lib/casserver/authenticators/active_resource.rb', line 31

def self.method_type
  @@method_type ||= :post
end

.method_type=(type) ⇒ Object

Raises:

  • (ArgumentError)


35
36
37
38
39
# File 'lib/casserver/authenticators/active_resource.rb', line 35

def self.method_type= type
  methods = [:get, :post, :put, :delete]
  raise ArgumentError, "Method type should be one of #{methods.map { |m| m.to_s.upcase }.join(', ')}" unless methods.include? type.to_sym
  @@method_type = type
end

Instance Method Details

#from_authentication_data(response) ⇒ Object

Used to load object attributes from the given response



49
50
51
# File 'lib/casserver/authenticators/active_resource.rb', line 49

def from_authentication_data response
  load_attributes_from_response(response)
end