ruby-mojeid 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /home/robin/rails_workspace/ruby-mojeid
3
3
  specs:
4
- ruby-mojeid (0.2.0)
4
+ ruby-mojeid (0.2.1)
5
5
  ruby-openid (= 2.1.8)
6
6
  ruby-openid (= 2.1.8)
7
7
 
@@ -24,6 +24,9 @@ class ConsumerController < ApplicationController
24
24
  @moje_id.return_to = url_for(:action => 'complete_get_data', :only_path => false)
25
25
  @moje_id.realm = url_for(:action => 'index', :id => nil, :only_path => false)
26
26
 
27
+
28
+ @moje_id.xrds_result = OpenID::Yadis::DiscoveryResult.new(@moje_id.return_to)
29
+
27
30
  # Redirect to generated url
28
31
  redirect_to @moje_id.redirect_url
29
32
  end
@@ -60,7 +63,9 @@ class ConsumerController < ApplicationController
60
63
  end
61
64
 
62
65
 
63
-
66
+ def xrds
67
+ render :inline => xrds_response(url_for(:action => 'complete_get_data', :only_path => false))
68
+ end
64
69
 
65
70
 
66
71
  private
@@ -1,5 +1,6 @@
1
1
  <html>
2
2
  <head>
3
+ <%= xrds_meta(request) %>
3
4
  <title>Rails mojeID Example</title>
4
5
  </head>
5
6
  <style type="text/css">
@@ -12,6 +12,7 @@ ActionController::Routing::Routes.draw do |map|
12
12
 
13
13
  map.connect '', :controller => 'consumer'
14
14
 
15
+ map.xrds 'xrds', :controller => "consumer", :action => "xrds"
15
16
  # Allow downloading Web Service WSDL as a file with an extension
16
17
  # instead of a file named 'wsdl'
17
18
  # Install the default route as the lowest priority.
data/lib/ruby-mojeid.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  require 'openid'
2
2
  require 'openid/extensions/ax'
3
+ require 'xrds_helpers'
3
4
  require 'available_attributes'
4
5
 
5
6
  class MojeID
6
- attr_accessor :moje_id_request, :moje_id_response, :fetch_request, :fetch_response, :realm, :return_to
7
+ attr_accessor :moje_id_request, :moje_id_response, :fetch_request, :fetch_response, :realm, :return_to, :xrds_result
7
8
 
8
9
  # Prepare request for openid server
9
10
  #
@@ -0,0 +1,17 @@
1
+ # Helper method that generate meta tag for xrds authentification
2
+
3
+ def xrds_meta(request)
4
+ "<meta http-equiv=\"x-xrds-location\" content=\"#{request.protocol}#{request.host_with_port}/xrds\" />"
5
+ end
6
+
7
+ def xrds_response(return_url)
8
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
9
+ <xrds:XRDS xmlns:xrds=\"xri://$xrds\" xmlns=\"xri://$xrd*($v*2.0)\">
10
+ <XRD>
11
+ <Service>
12
+ <Type>http://specs.openid.net/auth/2.0/return_to</Type>
13
+ <URI>#{return_url}</URI>
14
+ </Service>
15
+ </XRD>
16
+ </xrds:XRDS>"
17
+ end
data/ruby-mojeid.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ruby-mojeid}
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Robin Bortlik"]
12
- s.date = %q{2011-01-31}
12
+ s.date = %q{2011-02-01}
13
13
  s.description = %q{This gem extend ruby-openid gem}
14
14
  s.email = %q{robinbortlik@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -71,6 +71,7 @@ Gem::Specification.new do |s|
71
71
  "examples/rails_openid/test/test_helper.rb",
72
72
  "lib/available_attributes.rb",
73
73
  "lib/ruby-mojeid.rb",
74
+ "lib/xrds_helpers.rb",
74
75
  "ruby-mojeid.gemspec",
75
76
  "test/helper.rb",
76
77
  "test/test_ruby-mojeid.rb"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-mojeid
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Robin Bortlik
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-31 00:00:00 +01:00
18
+ date: 2011-02-01 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -174,6 +174,7 @@ files:
174
174
  - examples/rails_openid/test/test_helper.rb
175
175
  - lib/available_attributes.rb
176
176
  - lib/ruby-mojeid.rb
177
+ - lib/xrds_helpers.rb
177
178
  - ruby-mojeid.gemspec
178
179
  - test/helper.rb
179
180
  - test/test_ruby-mojeid.rb