merb-auth-more 0.9.13 → 1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,7 +24,7 @@ require 'openid/extensions/sreg'
24
24
  class Merb::Authentication
25
25
  module Strategies
26
26
  module Basic
27
- class OpenID < Base
27
+ class OpenID < Merb::Authentication::Strategy
28
28
  def run!
29
29
  if request.params[:'openid.mode']
30
30
  response = consumer.complete(request.send(:query_params), "#{request.protocol}://#{request.host}" + request.path)
@@ -47,8 +47,8 @@ class Merb::Authentication
47
47
  openid_reg = ::OpenID::SReg::Request.new
48
48
  openid_reg.request_fields(required_reg_fields)
49
49
  openid_request.add_extension(openid_reg)
50
- redirect_to = "#{request.protocol}://#{request.host}#{Merb::Router.url(:openid)}"
51
- redirect!(openid_request.redirect_url("#{request.protocol}://#{request.host}", redirect_to))
50
+ customize_openid_request!(openid_request)
51
+ redirect!(openid_request.redirect_url("#{request.protocol}://#{request.host}", openid_callback_url))
52
52
  rescue ::OpenID::OpenIDError => e
53
53
  request.session.authentication.errors.clear!
54
54
  request.session.authentication.errors.add(:openid, 'The OpenID verification failed')
@@ -58,6 +58,22 @@ class Merb::Authentication
58
58
  end # run!
59
59
 
60
60
 
61
+ # Overwrite this to add extra options to the OpenID request before it is made.
62
+ #
63
+ # @example request.return_to_args["remember_me"] = 1 # remember_me=1 is added when returning from the OpenID provider.
64
+ #
65
+ # @api overwritable
66
+ def customize_openid_request!(openid_request)
67
+ end
68
+
69
+ # Used to define the callback url for the openid provider. By default it
70
+ # is set to the named :openid route.
71
+ #
72
+ # @api overwritable
73
+ def openid_callback_url
74
+ "#{request.protocol}://#{request.host}#{Merb::Router.url(:openid)}"
75
+ end
76
+
61
77
  # Overwrite the on_success! method with the required behavior for successful logins
62
78
  #
63
79
  # @api overwritable
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merb-auth-more
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.13
4
+ version: "1.0"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Neighman
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-03 00:00:00 -08:00
12
+ date: 2008-11-08 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.9.13
23
+ version: "1.0"
24
24
  version:
25
25
  description: Additional resources for use with the merb-auth-core authentication framework.
26
26
  email: has.sox@gmail.com