Module: Repim::RelyingParty

Defined in:
lib/repim/relying_party.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &b) ⇒ Object (private)



92
93
94
95
# File 'lib/repim/relying_party.rb', line 92

def method_missing(m, *args, &b)
  return [request.protocol, request.host_with_port, "/"].join if m.to_sym == :root_url
  super
end

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/repim/relying_party.rb', line 5

def self.included(base)
  base.cattr_accessor :attribute_adapter
  base.cattr_accessor :signup_template

  base.skip_before_filter :authenticate
  base. = "users/new"

  base.extend(ClassMethods)
end

Instance Method Details

#createObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/repim/relying_party.rb', line 25

def create
  options = {}
  options[attribute_adapter.necessity] = attribute_adapter.keys if attribute_adapter

  begin
    authenticate_with_open_id(params[:openid_url], options) do |result, identity_url, personal_data|
      if result.successful?
        authenticate_success(identity_url, personal_data)
      else
        authenticate_failure(params.merge(:openid_url=>identity_url))
      end
    end
  rescue OpenID::OpenIDError => why
    logger.debug{ [why.message, why.backtrace].flatten.join("\n\t") }
    authenticate_failure(params)
  end
end

#destroyObject



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/repim/relying_party.rb', line 43

def destroy
  if self.class.with_single_access
    current_user.single_access_token = nil
    current_user.save(false)
    session[:single_access_token] = nil
  else
    session[:user_id] = nil
  end
  reset_session
  flash[:notice] = "You have been logged out."

  redirect_back_or(after_logout_path)
end

#newObject

render new.rhtml



22
23
# File 'lib/repim/relying_party.rb', line 22

def new
end