shibboleth-rails 0.3.11 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,12 +28,11 @@ module Shibboleth::Rails
28
28
  session.delete('new')
29
29
  else
30
30
  session['new'] = true
31
- if Rails.env.production? or Rails.env.staging?
32
- redirect_to [request.protocol, request.host,
33
- '/Shibboleth.sso/Login?target=', CGI.escape(requested_url)].join
31
+
32
+ if request.xhr?
33
+ render :json => {:login_url => login_url}, :status => 401
34
34
  else
35
- session['target'] = requested_url
36
- redirect_to new_user_session_url, :notice => 'Login first, please.'
35
+ redirect_to login_url
37
36
  end
38
37
  end
39
38
  end
@@ -45,6 +44,16 @@ module Shibboleth::Rails
45
44
  request.protocol + request.host + request.request_uri
46
45
  end
47
46
  end
47
+
48
+ def login_url
49
+ if Rails.env.production? || Rails.env.staging?
50
+ [request.protocol, request.host, '/Shibboleth.sso/Login?target=', CGI.escape(requested_url)].join
51
+ else
52
+ session['target'] = requested_url
53
+ new_user_session_url
54
+ end
55
+ end
56
+
48
57
  end
49
58
 
50
59
  end
@@ -1,5 +1,5 @@
1
1
  module Shibboleth
2
2
  module Rails
3
- VERSION = "0.3.11"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shibboleth-rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- - 11
10
- version: 0.3.11
5
+ version: 0.4.0
11
6
  platform: ruby
12
7
  authors:
13
8
  - mikegee
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2012-02-16 00:00:00 Z
13
+ date: 2012-03-22 00:00:00 Z
19
14
  dependencies:
20
15
  - !ruby/object:Gem::Dependency
21
16
  name: rails
@@ -25,10 +20,6 @@ dependencies:
25
20
  requirements:
26
21
  - - ~>
27
22
  - !ruby/object:Gem::Version
28
- hash: 7
29
- segments:
30
- - 3
31
- - 0
32
23
  version: "3.0"
33
24
  type: :runtime
34
25
  version_requirements: *id001
@@ -70,23 +61,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
70
61
  requirements:
71
62
  - - ">="
72
63
  - !ruby/object:Gem::Version
73
- hash: 3
74
- segments:
75
- - 0
76
64
  version: "0"
77
65
  required_rubygems_version: !ruby/object:Gem::Requirement
78
66
  none: false
79
67
  requirements:
80
68
  - - ">="
81
69
  - !ruby/object:Gem::Version
82
- hash: 3
83
- segments:
84
- - 0
85
70
  version: "0"
86
71
  requirements: []
87
72
 
88
73
  rubyforge_project: shibboleth-rails
89
- rubygems_version: 1.8.15
74
+ rubygems_version: 1.8.16
90
75
  signing_key:
91
76
  specification_version: 3
92
77
  summary: This Rails plugin integrates Shibboletth single signon.