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: {})


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

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

.method_typeObject



17
18
19
# File 'lib/casserver/authenticators/active_resource.rb', line 17

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

.method_type=(type) ⇒ Object

Raises:

  • (ArgumentError)


21
22
23
24
25
# File 'lib/casserver/authenticators/active_resource.rb', line 21

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



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

def from_authentication_data response
  load_attributes_from_response(response)
end