Module: AuthlogicConnect::Openid::Process
Instance Method Summary
collapse
Methods included from Variables
#openid_identifier, #openid_provider
Methods included from State
#authenticating_with_openid?, #complete_openid?, #openid_identifier?, #openid_provider?, #openid_request?, #openid_response?, #start_openid?, #using_openid?, #validate_password_with_openid?
Instance Method Details
#attributes_to_save ⇒ Object
65
66
67
|
# File 'lib/authlogic_connect/openid/process.rb', line 65
def attributes_to_save
{}
end
|
#call_openid ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/authlogic_connect/openid/process.rb', line 15
def call_openid
options = {}
options[:return_to] = auth_callback_url
auth_controller.send(:authenticate_with_open_id, openid_identifier, options) do |result, openid_identifier|
complete_openid_transaction(result, openid_identifier)
return true
end
return false
end
|
#cleanup_openid_session ⇒ Object
want to do this after the final save
43
44
45
46
47
48
|
# File 'lib/authlogic_connect/openid/process.rb', line 43
def cleanup_openid_session
[:auth_attributes, :authentication_type, :auth_callback_method].each {|key| remove_session_key(key)}
auth_session.each_key do |key|
remove_session_key(key) if key.to_s =~ /^OpenID/
end
end
|
#complete_openid ⇒ Object
10
11
12
13
|
# File 'lib/authlogic_connect/openid/process.rb', line 10
def complete_openid
restore_attributes
call_openid
end
|
#complete_openid_transaction(result, openid_identifier) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/authlogic_connect/openid/process.rb', line 29
def complete_openid_transaction(result, openid_identifier)
if result.unsuccessful?
errors.add_to_base(result.message)
end
if AccessToken.find_by_key(openid_identifier.normalize_identifier)
else
token = OpenidToken.new(:key => openid_identifier)
self.access_tokens << token
self.active_token = token
end
end
|
#restore_attributes ⇒ Object
69
70
71
72
|
# File 'lib/authlogic_connect/openid/process.rb', line 69
def restore_attributes
self.attributes = auth_session[:auth_attributes] unless is_auth_session?
end
|
#save_openid_session ⇒ Object
57
58
59
60
61
62
63
|
# File 'lib/authlogic_connect/openid/process.rb', line 57
def save_openid_session
auth_session[:auth_callback_method] = auth_controller.request.method
auth_session[:auth_attributes] = attributes_to_save
auth_session[:authentication_type] = auth_params[:authentication_type]
auth_session[:auth_method] = "openid"
end
|
#start_openid ⇒ Object
5
6
7
8
|
# File 'lib/authlogic_connect/openid/process.rb', line 5
def start_openid
save_openid_session
call_openid
end
|
#validate_by_openid ⇒ Object
50
51
52
53
54
55
|
# File 'lib/authlogic_connect/openid/process.rb', line 50
def validate_by_openid
if processing_authentication
authentication_protocol(:openid, :start) || authentication_protocol(:openid, :complete)
errors.add(:access_tokens, "had the following error: #{@openid_error}") if @openid_error
end
end
|