local-openid 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/.wrongdoc.yml +6 -0
- data/GIT-VERSION-GEN +1 -1
- data/GNUmakefile +6 -141
- data/README +7 -5
- data/Rakefile +19 -103
- data/lib/local_openid.rb +62 -23
- data/local-openid.gemspec +11 -19
- data/pkg.mk +175 -0
- metadata +58 -71
data/.gitignore
CHANGED
data/.wrongdoc.yml
ADDED
data/GIT-VERSION-GEN
CHANGED
data/GNUmakefile
CHANGED
@@ -1,145 +1,10 @@
|
|
1
1
|
all::
|
2
|
-
|
3
|
-
RAKE = rake
|
4
|
-
RSYNC = rsync
|
5
|
-
GIT_URL = git://git.bogomips.org/local-openid.git
|
6
|
-
|
7
|
-
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
|
8
|
-
@./GIT-VERSION-GEN
|
9
|
-
-include GIT-VERSION-FILE
|
10
|
-
|
11
|
-
pkg_extra := GIT-VERSION-FILE NEWS ChangeLog
|
12
|
-
manifest: $(pkg_extra)
|
13
|
-
$(RM) .manifest
|
14
|
-
$(MAKE) .manifest
|
15
|
-
|
16
|
-
.manifest:
|
17
|
-
(git ls-files && \
|
18
|
-
for i in $@ $(pkg_extra) $(man1_paths); \
|
19
|
-
do echo $$i; done) | LC_ALL=C sort > $@+
|
20
|
-
cmp $@+ $@ || mv $@+ $@
|
21
|
-
$(RM) $@+
|
22
|
-
|
23
|
-
NEWS: GIT-VERSION-FILE
|
24
|
-
$(RAKE) -s news_rdoc > $@+
|
25
|
-
mv $@+ $@
|
26
|
-
|
27
|
-
SINCE = 0.1.0
|
28
|
-
ChangeLog: LOG_VERSION = \
|
29
|
-
$(shell git rev-parse -q "$(GIT_VERSION)" >/dev/null 2>&1 && \
|
30
|
-
echo $(GIT_VERSION) || git describe)
|
31
|
-
ifneq ($(SINCE),)
|
32
|
-
ChangeLog: log_range = v$(SINCE)..$(LOG_VERSION)
|
33
|
-
endif
|
34
|
-
ChangeLog: GIT-VERSION-FILE
|
35
|
-
@echo "ChangeLog from $(GIT_URL) ($(log_range))" > $@+
|
36
|
-
@echo >> $@+
|
37
|
-
git log $(log_range) | sed -e 's/^/ /' >> $@+
|
38
|
-
mv $@+ $@
|
39
|
-
|
40
|
-
news_atom := http://bogomips.org/local-openid/NEWS.atom.xml
|
41
|
-
cgit_atom := http://git.bogomips.org/cgit/local-openid.git/atom/?h=master
|
42
|
-
atom = <link rel="alternate" title="Atom feed" href="$(1)" \
|
43
|
-
type="application/atom+xml"/>
|
44
|
-
|
45
|
-
doc: .document NEWS ChangeLog
|
46
|
-
find bin lib -type f -name '*.rbc' -exec rm -f '{}' ';'
|
47
|
-
rdoc -a -t "$(shell sed -ne '1s/^= //p' README)"
|
48
|
-
install -m644 COPYING doc/COPYING
|
49
|
-
install -m644 $(shell grep '^[A-Z]' .document) doc/
|
50
|
-
$(RUBY) -i -p -e \
|
51
|
-
'$$_.gsub!("</title>",%q{\&$(call atom,$(cgit_atom))})' \
|
52
|
-
doc/ChangeLog.html
|
53
|
-
$(RUBY) -i -p -e \
|
54
|
-
'$$_.gsub!("</title>",%q{\&$(call atom,$(news_atom))})' \
|
55
|
-
doc/NEWS.html doc/README.html
|
56
|
-
$(RAKE) -s news_atom > doc/NEWS.atom.xml
|
57
|
-
cd doc && ln README.html tmp && mv tmp index.html
|
58
|
-
|
59
|
-
publish_doc:
|
60
|
-
-git set-file-times
|
61
|
-
$(RM) -r doc ChangeLog NEWS
|
62
|
-
$(MAKE) doc LOG_VERSION=$(shell git tag -l | tail -1)
|
63
|
-
@awk 'BEGIN{RS="=== ";ORS=""}NR==2{sub(/\n$$/,"");print RS""$$0 }' \
|
64
|
-
< NEWS > doc/LATEST
|
65
|
-
find doc/images doc/js -type f | \
|
66
|
-
TZ=UTC xargs touch -d '1970-01-01 00:00:00' doc/rdoc.css
|
67
|
-
$(MAKE) doc_gz
|
68
|
-
chmod 644 $$(find doc -type f)
|
69
|
-
$(RSYNC) -av --delete doc/ bogomips.org:/srv/bogomips/local-openid/
|
70
|
-
git ls-files | xargs touch
|
71
|
-
|
72
|
-
ifneq ($(VERSION),)
|
2
|
+
RSYNC_DEST := bogomips.org:/srv/bogomips/local-openid
|
73
3
|
rfproject := qrp
|
74
4
|
rfpackage := local-openid
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
release-notes: $(release_notes)
|
81
|
-
release-changes: $(release_changes)
|
82
|
-
$(release_changes):
|
83
|
-
$(RAKE) -s release_changes > $@+
|
84
|
-
$(VISUAL) $@+ && test -s $@+ && mv $@+ $@
|
85
|
-
$(release_notes):
|
86
|
-
GIT_URL=$(GIT_URL) $(RAKE) -s release_notes > $@+
|
87
|
-
$(VISUAL) $@+ && test -s $@+ && mv $@+ $@
|
88
|
-
|
89
|
-
# ensures we're actually on the tagged $(VERSION), only used for release
|
90
|
-
verify:
|
91
|
-
test x"$(shell umask)" = x0022
|
92
|
-
git rev-parse --verify refs/tags/v$(VERSION)^{}
|
93
|
-
git diff-index --quiet HEAD^0
|
94
|
-
test `git rev-parse --verify HEAD^0` = \
|
95
|
-
`git rev-parse --verify refs/tags/v$(VERSION)^{}`
|
96
|
-
|
97
|
-
fix-perms:
|
98
|
-
-git ls-tree -r HEAD | awk '/^100644 / {print $$NF}' | xargs chmod 644
|
99
|
-
-git ls-tree -r HEAD | awk '/^100755 / {print $$NF}' | xargs chmod 755
|
100
|
-
|
101
|
-
gem: $(pkggem)
|
102
|
-
|
103
|
-
install-gem: $(pkggem)
|
104
|
-
gem install $(CURDIR)/$<
|
105
|
-
|
106
|
-
$(pkggem): manifest fix-perms
|
107
|
-
gem build $(rfpackage).gemspec
|
108
|
-
mkdir -p pkg
|
109
|
-
mv $(@F) $@
|
110
|
-
|
111
|
-
$(pkgtgz): distdir = $(basename $@)
|
112
|
-
$(pkgtgz): HEAD = v$(VERSION)
|
113
|
-
$(pkgtgz): manifest fix-perms
|
114
|
-
@test -n "$(distdir)"
|
115
|
-
$(RM) -r $(distdir)
|
116
|
-
mkdir -p $(distdir)
|
117
|
-
tar cf - `cat .manifest` | (cd $(distdir) && tar xf -)
|
118
|
-
cd pkg && tar c $(basename $(@F)) | gzip -9 > $(@F)+
|
119
|
-
mv $@+ $@
|
120
|
-
|
121
|
-
package: $(pkgtgz) $(pkggem)
|
122
|
-
|
123
|
-
test-release: verify package $(release_notes) $(release_changes)
|
124
|
-
release: verify package $(release_notes) $(release_changes)
|
125
|
-
# make tgz release on RubyForge
|
126
|
-
rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
|
127
|
-
$(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
|
128
|
-
# push gem to Gemcutter
|
129
|
-
gem push $(pkggem)
|
130
|
-
# in case of gem downloads from RubyForge releases page
|
131
|
-
-rubyforge add_file \
|
132
|
-
$(rfproject) $(rfpackage) $(VERSION) $(pkggem)
|
133
|
-
else
|
134
|
-
gem install-gem: GIT-VERSION-FILE
|
135
|
-
$(MAKE) $@ VERSION=$(GIT_VERSION)
|
5
|
+
include pkg.mk
|
6
|
+
ifneq ($(VERSION),)
|
7
|
+
release::
|
8
|
+
$(RAKE) raa_update VERSION=$(VERSION)
|
9
|
+
$(RAKE) publish_news VERSION=$(VERSION)
|
136
10
|
endif
|
137
|
-
|
138
|
-
# Create gzip variants of the same timestamp as the original so nginx
|
139
|
-
# "gzip_static on" can serve the gzipped versions directly.
|
140
|
-
doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
|
141
|
-
doc_gz:
|
142
|
-
touch doc/NEWS.atom.xml -d "$$(awk 'NR==1{print $$4,$$5,$$6}' NEWS)"
|
143
|
-
for i in $(docs); do \
|
144
|
-
gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
|
145
|
-
.PHONY: .FORCE-GIT-VERSION-FILE doc manifest
|
data/README
CHANGED
@@ -10,6 +10,8 @@ instead of authenticating through HTTP/HTTPS.
|
|
10
10
|
4. Login using your OpenID (on the consumer)
|
11
11
|
- you should be redirected to your local-openid application
|
12
12
|
5. edit ~/.local-openid/config.yml on your server to approve the consumer
|
13
|
+
This config file is only created after the consumer makes a successful
|
14
|
+
request to your server.
|
13
15
|
6. Reload the local-openid page your browser was on.
|
14
16
|
- you should be logged in to the OpenID consumer site
|
15
17
|
- If not, check the error log (usually stderr) of local-openid
|
@@ -63,7 +65,7 @@ I don't have any plans for more development with local-openid. It was
|
|
63
65
|
after all, just a weekend hack. It does what I want it to and nothing
|
64
66
|
more.
|
65
67
|
|
66
|
-
You can use the {mailing list}[mailto:local.openid@librelist.
|
68
|
+
You can use the {mailing list}[mailto:local.openid@librelist.org] to
|
67
69
|
share ideas, patches, pull requests with other users. Remember, I
|
68
70
|
wrote local-openid because I find the web difficult to use. So I'll
|
69
71
|
only accept communication about local-openid via email :)
|
@@ -73,14 +75,14 @@ a line if you fix any bugs or notice any security holes in it.
|
|
73
75
|
|
74
76
|
You can get the latest source via git from the following locations:
|
75
77
|
|
76
|
-
git://
|
77
|
-
http://
|
78
|
+
git://bogomips.org/local-openid.git
|
79
|
+
http://bogomips.org/local-openid.git
|
78
80
|
git://repo.or.cz/local-openid.git (mirror)
|
79
81
|
http://repo.or.cz/r/local-openid.git (mirror)
|
80
82
|
|
81
83
|
You may browse the code from the web and download the latest tarballs here:
|
82
84
|
|
83
|
-
* http://
|
85
|
+
* http://bogomips.org/local-openid.git
|
84
86
|
* http://repo.or.cz/w/local-openid.git (gitweb mirror)
|
85
87
|
|
86
88
|
== Disclaimer
|
@@ -95,4 +97,4 @@ credentials when your provider implementation has 99.999% downtime :)
|
|
95
97
|
|
96
98
|
* Original author: Eric Wong, normalperson@yhbt.net
|
97
99
|
* OpenID: http://e.yhbt.net/
|
98
|
-
* mailing list: local.openid@librelist.
|
100
|
+
* mailing list: local.openid@librelist.org
|
data/Rakefile
CHANGED
@@ -1,110 +1,26 @@
|
|
1
1
|
# -*- encoding: binary -*-
|
2
|
-
|
2
|
+
require 'wrongdoc'
|
3
|
+
cgit_url = Wrongdoc.config[:cgit_url]
|
4
|
+
git_url = Wrongdoc.config[:git_url]
|
3
5
|
|
4
|
-
|
5
|
-
timefmt = '%Y-%m-%dT%H:%M:%SZ'
|
6
|
-
@tags ||= `git tag -l`.split(/\n/).map do |tag|
|
7
|
-
if %r{\Av[\d\.]+\z} =~ tag
|
8
|
-
header, subject, body = `git cat-file tag #{tag}`.split(/\n\n/, 3)
|
9
|
-
header = header.split(/\n/)
|
10
|
-
tagger = header.grep(/\Atagger /).first
|
11
|
-
body ||= "initial"
|
12
|
-
{
|
13
|
-
:time => Time.at(tagger.split(/ /)[-2].to_i).utc.strftime(timefmt),
|
14
|
-
:tagger_name => %r{^tagger ([^<]+)}.match(tagger)[1].strip,
|
15
|
-
:tagger_email => %r{<([^>]+)>}.match(tagger)[1].strip,
|
16
|
-
:id => `git rev-parse refs/tags/#{tag}`.chomp!,
|
17
|
-
:tag => tag,
|
18
|
-
:subject => subject,
|
19
|
-
:body => body,
|
20
|
-
}
|
21
|
-
end
|
22
|
-
end.compact.sort { |a,b| b[:time] <=> a[:time] }
|
23
|
-
end
|
24
|
-
|
25
|
-
cgit_url = "http://git.bogomips.org/cgit/local-openid.git"
|
26
|
-
git_url = ENV['GIT_URL'] || 'git://git.bogomips.org/local-openid.git'
|
27
|
-
|
28
|
-
desc 'prints news as an Atom feed'
|
29
|
-
task :news_atom do
|
30
|
-
require 'nokogiri'
|
31
|
-
new_tags = tags[0,10]
|
32
|
-
puts(Nokogiri::XML::Builder.new do
|
33
|
-
feed :xmlns => "http://www.w3.org/2005/Atom" do
|
34
|
-
id! "http://bogomips.org/local-openid/NEWS.atom.xml"
|
35
|
-
title "local-openid news"
|
36
|
-
subtitle %q{Single User, Ephemeral OpenID Provider}
|
37
|
-
link! :rel => 'alternate', :type => 'text/html',
|
38
|
-
:href => 'http://bogomips.org/local-openid/NEWS.html'
|
39
|
-
updated(new_tags.empty? ? "1970-01-01T00:00:00Z" : new_tags.first[:time])
|
40
|
-
new_tags.each do |tag|
|
41
|
-
entry do
|
42
|
-
title tag[:subject]
|
43
|
-
updated tag[:time]
|
44
|
-
published tag[:time]
|
45
|
-
author {
|
46
|
-
name tag[:tagger_name]
|
47
|
-
email tag[:tagger_email]
|
48
|
-
}
|
49
|
-
url = "#{cgit_url}/tag/?id=#{tag[:tag]}"
|
50
|
-
link! :rel => "alternate", :type => "text/html", :href =>url
|
51
|
-
id! url
|
52
|
-
message_only = tag[:body].split(/\n.+\(\d+\):\n {6}/s).first.strip
|
53
|
-
content({:type =>:text}, message_only)
|
54
|
-
content(:type =>:xhtml) { pre tag[:body] }
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end.to_xml)
|
59
|
-
end
|
60
|
-
|
61
|
-
desc 'prints RDoc-formatted news'
|
62
|
-
task :news_rdoc do
|
63
|
-
tags.each do |tag|
|
64
|
-
time = tag[:time].tr!('T', ' ').gsub!(/:\d\dZ/, ' UTC')
|
65
|
-
puts "=== #{tag[:tag].sub(/^v/, '')} / #{time}"
|
66
|
-
puts ""
|
67
|
-
|
68
|
-
body = tag[:body]
|
69
|
-
puts tag[:body].gsub(/^/sm, " ").gsub(/[ \t]+$/sm, "")
|
70
|
-
puts ""
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
desc "print release changelog for Rubyforge"
|
75
|
-
task :release_changes do
|
76
|
-
version = ENV['VERSION'] or abort "VERSION= needed"
|
77
|
-
version = "v#{version}"
|
78
|
-
vtags = tags.map { |tag| tag[:tag] =~ /\Av/ and tag[:tag] }.sort
|
79
|
-
prev = vtags[vtags.index(version) - 1]
|
80
|
-
if prev
|
81
|
-
system('git', 'diff', '--stat', prev, version) or abort $?
|
82
|
-
puts ""
|
83
|
-
system('git', 'log', "#{prev}..#{version}") or abort $?
|
84
|
-
else
|
85
|
-
system('git', 'log', version) or abort $?
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
desc "print release notes for Rubyforge"
|
90
|
-
task :release_notes do
|
91
|
-
spec = Gem::Specification.load('local-openid.gemspec')
|
92
|
-
puts spec.description.strip
|
93
|
-
puts ""
|
94
|
-
puts "* #{spec.homepage}"
|
95
|
-
puts "* #{spec.email}"
|
96
|
-
puts "* #{git_url}"
|
97
|
-
|
98
|
-
_, _, body = `git cat-file tag v#{spec.version}`.split(/\n\n/, 3)
|
99
|
-
print "\nChanges:\n\n"
|
100
|
-
puts body
|
101
|
-
end
|
102
|
-
|
103
|
-
desc "read news article from STDIN and post to rubyforge"
|
6
|
+
desc "post news article to rubyforge"
|
104
7
|
task :publish_news do
|
105
8
|
require 'rubyforge'
|
106
|
-
|
107
|
-
|
9
|
+
spec = Gem::Specification.load('local-openid.gemspec')
|
10
|
+
tmp = Tempfile.new('rf-news')
|
11
|
+
_, subject, body = `git cat-file tag v#{spec.version}`.split(/\n\n/, 3)
|
12
|
+
tmp.puts subject
|
13
|
+
tmp.puts
|
14
|
+
tmp.puts spec.description.strip
|
15
|
+
tmp.puts ""
|
16
|
+
tmp.puts "* #{spec.homepage}"
|
17
|
+
tmp.puts "* #{spec.email}"
|
18
|
+
tmp.puts "* #{git_url}"
|
19
|
+
tmp.print "\nChanges:\n\n"
|
20
|
+
tmp.puts body
|
21
|
+
tmp.flush
|
22
|
+
system(ENV["VISUAL"], tmp.path) or abort "#{ENV["VISUAL"]} failed: #$?"
|
23
|
+
msg = File.readlines(tmp.path)
|
108
24
|
subject = msg.shift
|
109
25
|
blank = msg.shift
|
110
26
|
blank == "\n" or abort "no newline after subject!"
|
data/lib/local_openid.rb
CHANGED
@@ -23,9 +23,12 @@ class LocalOpenID < Sinatra::Base
|
|
23
23
|
Dir.mkdir(@@dir) unless File.directory?(@@dir)
|
24
24
|
|
25
25
|
# all the sinatra endpoints:
|
26
|
-
get('/xrds') { big_lock {
|
27
|
-
get('/') { big_lock {
|
28
|
-
|
26
|
+
get('/xrds') { big_lock { render_identity_xrds(true) } }
|
27
|
+
get('/provider/xrds') { big_lock { render_provider_xrds(true) } }
|
28
|
+
get('/provider') { big_lock { get_or_post_provider } }
|
29
|
+
post('/provider') { big_lock { get_or_post_provider } }
|
30
|
+
get('/') { big_lock { render_identity_xrds } }
|
31
|
+
post('/') { big_lock { render_identity_xrds } }
|
29
32
|
|
30
33
|
private
|
31
34
|
|
@@ -35,21 +38,44 @@ class LocalOpenID < Sinatra::Base
|
|
35
38
|
<body><h1>reload this page when approved: %s</h1></body>
|
36
39
|
</html>!
|
37
40
|
|
38
|
-
|
39
|
-
<
|
40
|
-
<link rel="openid2.provider" href="%s" />
|
41
|
-
<meta http-equiv="X-XRDS-Location" content="%sxrds" />
|
41
|
+
PROVIDER_XRDS_HTML = %q!<html><head>
|
42
|
+
<meta http-equiv="X-XRDS-Location" content="%sprovider/xrds" />
|
42
43
|
<title>OpenID server endpoint</title>
|
43
44
|
</head><body>OpenID server endpoint</body></html>!
|
44
45
|
|
45
|
-
|
46
|
+
IDENTITY_XRDS_HTML = %q!<html><head>
|
47
|
+
<link rel="openid.server" href="%sprovider" />
|
48
|
+
<link rel="openid2.provider" href="%sprovider" />
|
49
|
+
<link rel="openid2.local_id" href="%s" />
|
50
|
+
<link rel="openid.delegate" href="%s" />
|
51
|
+
<meta http-equiv="X-XRDS-Location" content="%sxrds" />
|
52
|
+
<title>OpenID identity</title>
|
53
|
+
</head><body>OpenID identity</body></html>!
|
54
|
+
|
55
|
+
PROVIDER_XRDS_XML = %q!<?xml version="1.0" encoding="UTF-8"?>
|
56
|
+
<xrds:XRDS
|
57
|
+
xmlns:xrds="xri://$xrds"
|
58
|
+
xmlns:openid="http://openid.net/xmlns/1.0"
|
59
|
+
xmlns="xri://$xrd*($v*2.0)">
|
60
|
+
<XRD version="2.0">
|
61
|
+
<Service priority="0">
|
62
|
+
%types
|
63
|
+
<URI>%sprovider</URI>
|
64
|
+
</Service>
|
65
|
+
</XRD>
|
66
|
+
</xrds:XRDS>!
|
67
|
+
|
68
|
+
IDENTITY_XRDS_XML = %q!<?xml version="1.0" encoding="UTF-8"?>
|
46
69
|
<xrds:XRDS
|
47
70
|
xmlns:xrds="xri://$xrds"
|
71
|
+
xmlns:openid="http://openid.net/xmlns/1.0"
|
48
72
|
xmlns="xri://$xrd*($v*2.0)">
|
49
|
-
<XRD>
|
73
|
+
<XRD version="2.0">
|
50
74
|
<Service priority="0">
|
51
75
|
%types
|
52
|
-
<URI>%
|
76
|
+
<URI>%sprovider</URI>
|
77
|
+
<LocalID>%s</LocalID>
|
78
|
+
<openid:Delegate>%s</openid:Delegate>
|
53
79
|
</Service>
|
54
80
|
</XRD>
|
55
81
|
</xrds:XRDS>!
|
@@ -81,7 +107,7 @@ class LocalOpenID < Sinatra::Base
|
|
81
107
|
- updated Time this entry was updated, strictly informational.
|
82
108
|
- session_id Unique identifier in your session cookie to prevent
|
83
109
|
other users from hijacking your session. You may
|
84
|
-
delete this if you
|
110
|
+
delete this if you have changed browsers or computers.
|
85
111
|
- assoc_handle See the OpenID specs, may be empty. Do not edit this.
|
86
112
|
|
87
113
|
SReg keys supported by the Ruby OpenID implementation should be
|
@@ -97,14 +123,14 @@ class LocalOpenID < Sinatra::Base
|
|
97
123
|
|
98
124
|
# this is the heart of our provider logic, adapted from the
|
99
125
|
# Ruby OpenID gem Rails example
|
100
|
-
def
|
126
|
+
def get_or_post_provider
|
101
127
|
oidreq = begin
|
102
128
|
server.decode_request(params)
|
103
129
|
rescue ProtocolError => err
|
104
130
|
halt(500, err.to_s)
|
105
131
|
end
|
106
132
|
|
107
|
-
oidreq or return
|
133
|
+
oidreq or return render_provider_xrds
|
108
134
|
|
109
135
|
oidresp = case oidreq
|
110
136
|
when CheckIDRequest
|
@@ -116,7 +142,7 @@ class LocalOpenID < Sinatra::Base
|
|
116
142
|
add_pape(oidreq, resp)
|
117
143
|
resp
|
118
144
|
elsif oidreq.immediate
|
119
|
-
oidreq.answer(false, server_root)
|
145
|
+
oidreq.answer(false, server_root + "provider")
|
120
146
|
else
|
121
147
|
session[:id] ||= "#{Time.now.to_i}.#$$.#{rand}"
|
122
148
|
session[:ip] = request.ip
|
@@ -144,7 +170,7 @@ class LocalOpenID < Sinatra::Base
|
|
144
170
|
def server
|
145
171
|
@server ||= Server.new(
|
146
172
|
OpenID::Store::Filesystem.new("#@@dir/store"),
|
147
|
-
server_root)
|
173
|
+
server_root + "provider")
|
148
174
|
end
|
149
175
|
|
150
176
|
# support the simple registration extension if possible,
|
@@ -264,22 +290,35 @@ class LocalOpenID < Sinatra::Base
|
|
264
290
|
end
|
265
291
|
|
266
292
|
# this output is designed to be parsed by OpenID consumers
|
267
|
-
def
|
293
|
+
def render_provider_xrds(force = false)
|
294
|
+
if force || request.accept.include?('application/xrds+xml')
|
295
|
+
|
296
|
+
# this seems to work...
|
297
|
+
types = [ OpenID::OPENID_IDP_2_0_TYPE ]
|
298
|
+
|
299
|
+
headers['Content-Type'] = 'application/xrds+xml'
|
300
|
+
types = types.map { |uri| "<Type>#{uri}</Type>" }.join("\n")
|
301
|
+
PROVIDER_XRDS_XML.gsub(/%s/, server_root).gsub!(/%types/, types)
|
302
|
+
else # render a browser-friendly page with an XRDS pointer
|
303
|
+
headers['X-XRDS-Location'] = "#{server_root}provider/xrds"
|
304
|
+
PROVIDER_XRDS_HTML.gsub(/%s/, server_root)
|
305
|
+
end
|
306
|
+
end
|
307
|
+
|
308
|
+
def render_identity_xrds(force = false)
|
268
309
|
if force || request.accept.include?('application/xrds+xml')
|
269
310
|
|
270
311
|
# this seems to work...
|
271
|
-
types =
|
272
|
-
|
273
|
-
|
274
|
-
OpenID::SREG_URI ] :
|
275
|
-
[ OpenID::OPENID_IDP_2_0_TYPE ]
|
312
|
+
types = [ OpenID::OPENID_2_0_TYPE,
|
313
|
+
OpenID::OPENID_1_0_TYPE,
|
314
|
+
OpenID::SREG_URI ]
|
276
315
|
|
277
316
|
headers['Content-Type'] = 'application/xrds+xml'
|
278
317
|
types = types.map { |uri| "<Type>#{uri}</Type>" }.join("\n")
|
279
|
-
|
318
|
+
IDENTITY_XRDS_XML.gsub(/%s/, server_root).gsub!(/%types/, types)
|
280
319
|
else # render a browser-friendly page with an XRDS pointer
|
281
320
|
headers['X-XRDS-Location'] = "#{server_root}xrds"
|
282
|
-
|
321
|
+
IDENTITY_XRDS_HTML.gsub(/%s/, server_root)
|
283
322
|
end
|
284
323
|
end
|
285
324
|
|
data/local-openid.gemspec
CHANGED
@@ -1,34 +1,26 @@
|
|
1
1
|
ENV["VERSION"] or abort "VERSION= must be specified"
|
2
2
|
manifest = File.readlines('.manifest').map! { |x| x.chomp! }
|
3
|
+
require 'wrongdoc'
|
4
|
+
extend Wrongdoc::Gemspec
|
5
|
+
name, summary, title = readme_metadata
|
3
6
|
|
4
7
|
Gem::Specification.new do |s|
|
5
8
|
s.name = %q{local-openid}
|
6
|
-
s.version = ENV["VERSION"]
|
9
|
+
s.version = ENV["VERSION"].dup
|
7
10
|
|
8
11
|
s.authors = ["Eric Wong"]
|
9
12
|
s.date = Time.now.utc.strftime('%Y-%m-%d')
|
10
|
-
s.description =
|
11
|
-
s.email = %q{local
|
13
|
+
s.description = readme_description
|
14
|
+
s.email = %q{local.openid@librelist.org}
|
12
15
|
s.executables = %w(local-openid)
|
13
16
|
|
14
|
-
s.extra_rdoc_files =
|
15
|
-
x.chomp!
|
16
|
-
if File.directory?(x)
|
17
|
-
manifest.grep(%r{\A#{x}/})
|
18
|
-
elsif File.file?(x)
|
19
|
-
x
|
20
|
-
else
|
21
|
-
nil
|
22
|
-
end
|
23
|
-
end.flatten.compact
|
24
|
-
|
17
|
+
s.extra_rdoc_files = extra_rdoc_files(manifest)
|
25
18
|
s.files = manifest
|
26
|
-
s.homepage =
|
27
|
-
s.summary =
|
28
|
-
s.rdoc_options =
|
29
|
-
s.require_paths = %w(lib)
|
19
|
+
s.homepage = Wrongdoc.config[:rdoc_url]
|
20
|
+
s.summary = summary
|
21
|
+
s.rdoc_options = rdoc_options
|
30
22
|
s.rubyforge_project = %q{qrp}
|
31
|
-
s.add_dependency(%q<sinatra>, ["~> 1.0
|
23
|
+
s.add_dependency(%q<sinatra>, ["~> 1.0"])
|
32
24
|
s.add_dependency(%q<ruby-openid>, ["~> 2.1.7"])
|
33
25
|
# s.licenses = %w(AGPLv3) # accessor not compatible with older RubyGems
|
34
26
|
end
|
data/pkg.mk
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
RUBY = ruby
|
2
|
+
RAKE = rake
|
3
|
+
RSYNC = rsync
|
4
|
+
WRONGDOC = wrongdoc
|
5
|
+
|
6
|
+
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
|
7
|
+
@./GIT-VERSION-GEN
|
8
|
+
-include GIT-VERSION-FILE
|
9
|
+
-include local.mk
|
10
|
+
DLEXT := $(shell $(RUBY) -rrbconfig -e 'puts RbConfig::CONFIG["DLEXT"]')
|
11
|
+
RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION')
|
12
|
+
RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))')
|
13
|
+
lib := lib
|
14
|
+
|
15
|
+
ifeq ($(shell test -f script/isolate_for_tests && echo t),t)
|
16
|
+
isolate_libs := tmp/isolate/$(RUBY_ENGINE)-$(RUBY_VERSION)/isolate.mk
|
17
|
+
$(isolate_libs): script/isolate_for_tests
|
18
|
+
@$(RUBY) script/isolate_for_tests
|
19
|
+
-include $(isolate_libs)
|
20
|
+
lib := $(lib):$(ISOLATE_LIBS)
|
21
|
+
endif
|
22
|
+
|
23
|
+
ext := $(firstword $(wildcard ext/*))
|
24
|
+
ifneq ($(ext),)
|
25
|
+
ext_pfx := tmp/ext/$(RUBY_ENGINE)-$(RUBY_VERSION)
|
26
|
+
ext_h := $(wildcard $(ext)/*/*.h $(ext)/*.h)
|
27
|
+
ext_src := $(wildcard $(ext)/*.c $(ext_h))
|
28
|
+
ext_pfx_src := $(addprefix $(ext_pfx)/,$(ext_src))
|
29
|
+
ext_d := $(ext_pfx)/$(ext)/.d
|
30
|
+
$(ext)/extconf.rb: $(wildcard $(ext)/*.h)
|
31
|
+
@>> $@
|
32
|
+
$(ext_d):
|
33
|
+
@mkdir -p $(@D)
|
34
|
+
@> $@
|
35
|
+
$(ext_pfx)/$(ext)/%: $(ext)/% $(ext_d)
|
36
|
+
install -m 644 $< $@
|
37
|
+
$(ext_pfx)/$(ext)/Makefile: $(ext)/extconf.rb $(ext_d) $(ext_h)
|
38
|
+
$(RM) -f $(@D)/*.o
|
39
|
+
cd $(@D) && $(RUBY) $(CURDIR)/$(ext)/extconf.rb
|
40
|
+
ext_sfx := _ext.$(DLEXT)
|
41
|
+
ext_dl := $(ext_pfx)/$(ext)/$(notdir $(ext)_ext.$(DLEXT))
|
42
|
+
$(ext_dl): $(ext_src) $(ext_pfx_src) $(ext_pfx)/$(ext)/Makefile
|
43
|
+
@echo $^ == $@
|
44
|
+
$(MAKE) -C $(@D)
|
45
|
+
lib := $(lib):$(ext_pfx)/$(ext)
|
46
|
+
build: $(ext_dl)
|
47
|
+
else
|
48
|
+
build:
|
49
|
+
endif
|
50
|
+
|
51
|
+
pkg_extra += GIT-VERSION-FILE NEWS ChangeLog LATEST
|
52
|
+
ChangeLog: GIT-VERSION-FILE .wrongdoc.yml
|
53
|
+
$(WRONGDOC) prepare
|
54
|
+
NEWS LATEST: ChangeLog
|
55
|
+
|
56
|
+
manifest:
|
57
|
+
$(RM) .manifest
|
58
|
+
$(MAKE) .manifest
|
59
|
+
|
60
|
+
.manifest: $(pkg_extra)
|
61
|
+
(git ls-files && for i in $@ $(pkg_extra); do echo $$i; done) | \
|
62
|
+
LC_ALL=C sort > $@+
|
63
|
+
cmp $@+ $@ || mv $@+ $@
|
64
|
+
$(RM) $@+
|
65
|
+
|
66
|
+
doc:: .document .wrongdoc.yml $(pkg_extra)
|
67
|
+
-find lib -type f -name '*.rbc' -exec rm -f '{}' ';'
|
68
|
+
-find ext -type f -name '*.rbc' -exec rm -f '{}' ';'
|
69
|
+
$(RM) -r doc
|
70
|
+
$(WRONGDOC) all
|
71
|
+
install -m644 COPYING doc/COPYING
|
72
|
+
install -m644 $(shell LC_ALL=C grep '^[A-Z]' .document) doc/
|
73
|
+
|
74
|
+
ifneq ($(VERSION),)
|
75
|
+
pkggem := pkg/$(rfpackage)-$(VERSION).gem
|
76
|
+
pkgtgz := pkg/$(rfpackage)-$(VERSION).tgz
|
77
|
+
release_notes := release_notes-$(VERSION)
|
78
|
+
release_changes := release_changes-$(VERSION)
|
79
|
+
|
80
|
+
release-notes: $(release_notes)
|
81
|
+
release-changes: $(release_changes)
|
82
|
+
$(release_changes):
|
83
|
+
$(WRONGDOC) release_changes > $@+
|
84
|
+
$(VISUAL) $@+ && test -s $@+ && mv $@+ $@
|
85
|
+
$(release_notes):
|
86
|
+
$(WRONGDOC) release_notes > $@+
|
87
|
+
$(VISUAL) $@+ && test -s $@+ && mv $@+ $@
|
88
|
+
|
89
|
+
# ensures we're actually on the tagged $(VERSION), only used for release
|
90
|
+
verify:
|
91
|
+
test x"$(shell umask)" = x0022
|
92
|
+
git rev-parse --verify refs/tags/v$(VERSION)^{}
|
93
|
+
git diff-index --quiet HEAD^0
|
94
|
+
test $$(git rev-parse --verify HEAD^0) = \
|
95
|
+
$$(git rev-parse --verify refs/tags/v$(VERSION)^{})
|
96
|
+
|
97
|
+
fix-perms:
|
98
|
+
-git ls-tree -r HEAD | awk '/^100644 / {print $$NF}' | xargs chmod 644
|
99
|
+
-git ls-tree -r HEAD | awk '/^100755 / {print $$NF}' | xargs chmod 755
|
100
|
+
|
101
|
+
gem: $(pkggem)
|
102
|
+
|
103
|
+
install-gem: $(pkggem)
|
104
|
+
gem install $(CURDIR)/$<
|
105
|
+
|
106
|
+
$(pkggem): manifest fix-perms
|
107
|
+
gem build $(rfpackage).gemspec
|
108
|
+
mkdir -p pkg
|
109
|
+
mv $(@F) $@
|
110
|
+
|
111
|
+
$(pkgtgz): distdir = $(basename $@)
|
112
|
+
$(pkgtgz): HEAD = v$(VERSION)
|
113
|
+
$(pkgtgz): manifest fix-perms
|
114
|
+
@test -n "$(distdir)"
|
115
|
+
$(RM) -r $(distdir)
|
116
|
+
mkdir -p $(distdir)
|
117
|
+
tar cf - $$(cat .manifest) | (cd $(distdir) && tar xf -)
|
118
|
+
cd pkg && tar cf - $(basename $(@F)) | gzip -9 > $(@F)+
|
119
|
+
mv $@+ $@
|
120
|
+
|
121
|
+
package: $(pkgtgz) $(pkggem)
|
122
|
+
|
123
|
+
test-release:: verify package $(release_notes) $(release_changes)
|
124
|
+
# make tgz release on RubyForge
|
125
|
+
@echo rubyforge add_release -f \
|
126
|
+
-n $(release_notes) -a $(release_changes) \
|
127
|
+
$(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
|
128
|
+
@echo gem push $(pkggem)
|
129
|
+
@echo rubyforge add_file \
|
130
|
+
$(rfproject) $(rfpackage) $(VERSION) $(pkggem)
|
131
|
+
release:: verify package $(release_notes) $(release_changes)
|
132
|
+
# make tgz release on RubyForge
|
133
|
+
rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
|
134
|
+
$(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
|
135
|
+
# push gem to RubyGems.org
|
136
|
+
gem push $(pkggem)
|
137
|
+
# in case of gem downloads from RubyForge releases page
|
138
|
+
rubyforge add_file \
|
139
|
+
$(rfproject) $(rfpackage) $(VERSION) $(pkggem)
|
140
|
+
else
|
141
|
+
gem install-gem: GIT-VERSION-FILE
|
142
|
+
$(MAKE) $@ VERSION=$(GIT_VERSION)
|
143
|
+
endif
|
144
|
+
|
145
|
+
all:: test
|
146
|
+
test_units := $(wildcard test/test_*.rb)
|
147
|
+
test: test-unit
|
148
|
+
test-unit: $(test_units)
|
149
|
+
$(test_units): build
|
150
|
+
$(RUBY) -I $(lib) $@ $(RUBY_TEST_OPTS)
|
151
|
+
|
152
|
+
# this requires GNU coreutils variants
|
153
|
+
ifneq ($(RSYNC_DEST),)
|
154
|
+
publish_doc:
|
155
|
+
-git set-file-times
|
156
|
+
$(MAKE) doc
|
157
|
+
find doc/images -type f | \
|
158
|
+
TZ=UTC xargs touch -d '1970-01-01 00:00:06' doc/rdoc.css
|
159
|
+
$(MAKE) doc_gz
|
160
|
+
$(RSYNC) -av doc/ $(RSYNC_DEST)/
|
161
|
+
git ls-files | xargs touch
|
162
|
+
endif
|
163
|
+
|
164
|
+
# Create gzip variants of the same timestamp as the original so nginx
|
165
|
+
# "gzip_static on" can serve the gzipped versions directly.
|
166
|
+
doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
|
167
|
+
doc_gz:
|
168
|
+
for i in $(docs); do \
|
169
|
+
gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
|
170
|
+
check-warnings:
|
171
|
+
@(for i in $$(git ls-files '*.rb'| grep -v '^setup\.rb$$'); \
|
172
|
+
do $(RUBY) -d -W2 -c $$i; done) | grep -v '^Syntax OK$$' || :
|
173
|
+
|
174
|
+
.PHONY: all .FORCE-GIT-VERSION-FILE doc test $(test_units) manifest
|
175
|
+
.PHONY: check-warnings
|
metadata
CHANGED
@@ -1,78 +1,73 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: local-openid
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 0
|
10
|
-
version: 0.2.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Eric Wong
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-07-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: sinatra
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
18
|
+
requirements:
|
27
19
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 0
|
33
|
-
- 0
|
34
|
-
version: 1.0.0
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.0'
|
35
22
|
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: ruby-openid
|
39
23
|
prerelease: false
|
40
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
25
|
none: false
|
42
|
-
requirements:
|
26
|
+
requirements:
|
43
27
|
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: ruby-openid
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
50
37
|
version: 2.1.7
|
51
38
|
type: :runtime
|
52
|
-
|
53
|
-
|
54
|
-
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.1.7
|
46
|
+
description: ! 'local-openid allows users with shell accounts on servers to authenticate
|
47
|
+
|
55
48
|
with OpenID consumers by editing a YAML file in their home directory
|
56
|
-
|
57
|
-
|
58
|
-
|
49
|
+
|
50
|
+
instead of authenticating through HTTP/HTTPS.'
|
51
|
+
email: local.openid@librelist.org
|
52
|
+
executables:
|
59
53
|
- local-openid
|
60
54
|
extensions: []
|
61
|
-
|
62
|
-
extra_rdoc_files:
|
55
|
+
extra_rdoc_files:
|
63
56
|
- NEWS
|
64
57
|
- LICENSE
|
65
58
|
- ChangeLog
|
66
59
|
- README
|
67
|
-
files:
|
60
|
+
files:
|
68
61
|
- .document
|
69
62
|
- .gitignore
|
70
63
|
- .manifest
|
64
|
+
- .wrongdoc.yml
|
71
65
|
- COPYING
|
72
66
|
- ChangeLog
|
73
67
|
- GIT-VERSION-FILE
|
74
68
|
- GIT-VERSION-GEN
|
75
69
|
- GNUmakefile
|
70
|
+
- LATEST
|
76
71
|
- LICENSE
|
77
72
|
- NEWS
|
78
73
|
- README
|
@@ -80,42 +75,34 @@ files:
|
|
80
75
|
- bin/local-openid
|
81
76
|
- lib/local_openid.rb
|
82
77
|
- local-openid.gemspec
|
78
|
+
- pkg.mk
|
83
79
|
- setup.rb
|
84
|
-
has_rdoc: true
|
85
80
|
homepage: http://bogomips.org/local-openid/
|
86
81
|
licenses: []
|
87
|
-
|
88
82
|
post_install_message:
|
89
|
-
rdoc_options:
|
90
|
-
- -a
|
83
|
+
rdoc_options:
|
91
84
|
- -t
|
92
|
-
- local-openid
|
93
|
-
|
85
|
+
- ! 'local-openid: Single User, Ephemeral OpenID Provider'
|
86
|
+
- -W
|
87
|
+
- http://bogomips.org/local-openid.git/tree/%s
|
88
|
+
require_paths:
|
94
89
|
- lib
|
95
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
91
|
none: false
|
97
|
-
requirements:
|
98
|
-
- -
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
|
101
|
-
|
102
|
-
- 0
|
103
|
-
version: "0"
|
104
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
97
|
none: false
|
106
|
-
requirements:
|
107
|
-
- -
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
|
110
|
-
segments:
|
111
|
-
- 0
|
112
|
-
version: "0"
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
113
102
|
requirements: []
|
114
|
-
|
115
103
|
rubyforge_project: qrp
|
116
|
-
rubygems_version: 1.
|
104
|
+
rubygems_version: 1.8.23
|
117
105
|
signing_key:
|
118
106
|
specification_version: 3
|
119
|
-
summary: Single User, Ephemeral OpenID Provider
|
107
|
+
summary: ! 'openid: Single User, Ephemeral OpenID Provider'
|
120
108
|
test_files: []
|
121
|
-
|