Module: Passport::Certification::ClassMethods

Defined in:
lib/passport/core/certification.rb

Instance Method Summary collapse

Instance Method Details

#approve(user = nil) ⇒ Object Also known as: complete



23
24
25
# File 'lib/passport/core/certification.rb', line 23

def approve(user = nil)
  protocol.approve(user) if protocol
end

#approve?Boolean Also known as: complete?

Returns:

  • (Boolean)


18
19
20
# File 'lib/passport/core/certification.rb', line 18

def approve?
  Passport::Oauth::Protocol.response? # || Passport::OpenId::Protocol.complete?
end

#authenticate(user = nil, &block) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/passport/core/certification.rb', line 28

def authenticate(user = nil, &block)
  if process?
    process(user) # redirect to service
  elsif approve?
    token = approve(user)
    yield(token) if block_given?
    token
  end
end

#process(user = nil) ⇒ Object Also known as: start



13
14
15
# File 'lib/passport/core/certification.rb', line 13

def process(user = nil)
  protocol.process(user) if protocol
end

#process?Boolean Also known as: start?

Returns:

  • (Boolean)


8
9
10
# File 'lib/passport/core/certification.rb', line 8

def process?
  Passport::Oauth::Protocol.request?# || Passport::OpenId::Protocol.start?
end

#protocolObject



38
39
40
41
42
43
44
# File 'lib/passport/core/certification.rb', line 38

def protocol
  if Passport::Oauth::Protocol.active?
    Passport::Oauth::Protocol
  # elsif Passport::OpenId::Protocol.using?
    #Passport::OpenId::Protocol
  end
end