gollum-auth 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/gollum/auth.rb +6 -2
- data/lib/gollum/auth/request.rb +4 -0
- data/lib/gollum/auth/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5867d2b55705e2b346060eaf138626e937d4862e
|
4
|
+
data.tar.gz: af8d05dd55933ecf3bc4a87214d41fce69c6e3d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e17eb31adfcc920b856c6bd9f79d02b297954eac6cbf70075dcf5ef91a7dca9d5eb1f15844bdd654351fd2ffd9fd68b5c95900b0848da628cc42142ddcdd345f
|
7
|
+
data.tar.gz: a43bdaf6d61526b431fbfb3da7b27a69fae027ba81ece03298a3006e1f3be1b4d400f2bd5b14edbba617c5417fee6de703ca903d39286bd2ae8ee87fd1bb14b5
|
data/README.md
CHANGED
@@ -11,6 +11,8 @@ But it does not include user authentication (on purpose).
|
|
11
11
|
[HTTP Basic Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication)
|
12
12
|
to gollum so that only authenticated users have access to your wiki.
|
13
13
|
Optionally you can allow readonly-access for unauthenticated guests.
|
14
|
+
Also the current user's name and e-mail are passed to gollum (via session key
|
15
|
+
`gollum.author`) to see who changed what.
|
14
16
|
|
15
17
|
|
16
18
|
## Installation
|
data/lib/gollum/auth.rb
CHANGED
@@ -18,9 +18,13 @@ module Gollum
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def call(env)
|
21
|
-
|
21
|
+
request = Request.new(env)
|
22
|
+
if request.needs_authentication?(@opts[:allow_guests])
|
22
23
|
auth = Rack::Auth::Basic::Request.new(env)
|
23
|
-
|
24
|
+
if auth.provided? && auth.basic? && valid?(auth.credentials)
|
25
|
+
user = User.find(auth.credentials.first)
|
26
|
+
request.store_author_in_session(user)
|
27
|
+
else
|
24
28
|
return [
|
25
29
|
401,
|
26
30
|
{ 'Content-Type' => 'text/plain', 'WWW-Authenticate' => 'Basic realm="Gollum Wiki"' },
|
data/lib/gollum/auth/request.rb
CHANGED
@@ -4,6 +4,10 @@ module Gollum::Auth
|
|
4
4
|
!allow_guests || is_change_request?
|
5
5
|
end
|
6
6
|
|
7
|
+
def store_author_in_session(user)
|
8
|
+
session['gollum.author'] = { name: user.name, email: user.email }
|
9
|
+
end
|
10
|
+
|
7
11
|
private
|
8
12
|
|
9
13
|
# Returns true if the request includes a path that would result in a change
|
data/lib/gollum/auth/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gollum-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Björn Albers
|
@@ -168,5 +168,5 @@ rubyforge_project:
|
|
168
168
|
rubygems_version: 2.6.10
|
169
169
|
signing_key:
|
170
170
|
specification_version: 4
|
171
|
-
summary: gollum-auth-0.
|
171
|
+
summary: gollum-auth-0.4.0
|
172
172
|
test_files: []
|