lokka-basic_auth 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.rdoc +20 -0
- data/Rakefile +1 -0
- data/lib/lokka/basic_auth.rb +32 -0
- data/lib/lokka/basic_auth/version.rb +5 -0
- data/lokka-basic_auth.gemspec +24 -0
- metadata +91 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
= lokka-basic_auth
|
2
|
+
|
3
|
+
This is plugin for Lokka CMS.
|
4
|
+
This plugin provide a Basic Authentication on Website build by Lokka.
|
5
|
+
|
6
|
+
== Contributing to lokka-basic_auth
|
7
|
+
|
8
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
9
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
10
|
+
* Fork the project
|
11
|
+
* Start a feature/bugfix branch
|
12
|
+
* Commit and push until you are happy with your contribution
|
13
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
14
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
15
|
+
|
16
|
+
== Copyright
|
17
|
+
|
18
|
+
Copyright (c) 2011 Masaki Komagata. See LICENSE.txt for
|
19
|
+
further details.
|
20
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "lokka/version"
|
2
|
+
|
3
|
+
module Lokka
|
4
|
+
module BasicAuth
|
5
|
+
def self.registered(app)
|
6
|
+
app.before '*' do |path|
|
7
|
+
return if path =~ %r{^/admin/.*$}
|
8
|
+
username = Option.basic_auth_username
|
9
|
+
password = Option.basic_auth_password
|
10
|
+
if username and password
|
11
|
+
@auth ||= Rack::Auth::Basic::Request.new(request.env)
|
12
|
+
unless @auth.provided? && @auth.basic? &&
|
13
|
+
@auth.credentials && @auth.credentials == [username, password]
|
14
|
+
response['WWW-Authenticate'] = %(Basic realm="HTTP Auth")
|
15
|
+
throw(:halt, [401, "Not authorized\n"])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
app.get '/admin/plugins/basic_auth' do
|
21
|
+
haml :'plugin/lokka-basic_auth/views/index', :layout => :'admin/layout'
|
22
|
+
end
|
23
|
+
|
24
|
+
app.post '/admin/plugins/basic_auth' do
|
25
|
+
Option.basic_auth_username = params['basic_auth_username']
|
26
|
+
Option.basic_auth_password = params['basic_auth_password']
|
27
|
+
flash[:notice] = 'Updated.'
|
28
|
+
redirect '/admin/plugins/basic_auth'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "lokka/basic_auth/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "lokka-basic_auth"
|
7
|
+
s.version = Lokka::BasicAuth::VERSION
|
8
|
+
s.authors = ["Masaki Komagata"]
|
9
|
+
s.email = ["komagata@gmail.com"]
|
10
|
+
s.homepage = "http://lokka.org/"
|
11
|
+
s.summary = %q{Basic authentication plugin for Lokka.}
|
12
|
+
s.description = %q{Basic authentication plugin for Lokka.}
|
13
|
+
|
14
|
+
s.rubyforge_project = "lokka-basic_auth"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_development_dependency 'rake', '~> 0.9.2.2'
|
22
|
+
s.add_development_dependency 'rdoc', '~> 3.11'
|
23
|
+
s.add_runtime_dependency "sinatra"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lokka-basic_auth
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Masaki Komagata
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-12-21 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: &70311325671520 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.9.2.2
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70311325671520
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rdoc
|
27
|
+
requirement: &70311325671000 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.11'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70311325671000
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: sinatra
|
38
|
+
requirement: &70311325670620 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70311325670620
|
47
|
+
description: Basic authentication plugin for Lokka.
|
48
|
+
email:
|
49
|
+
- komagata@gmail.com
|
50
|
+
executables: []
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- .gitignore
|
55
|
+
- Gemfile
|
56
|
+
- README.rdoc
|
57
|
+
- Rakefile
|
58
|
+
- lib/lokka/basic_auth.rb
|
59
|
+
- lib/lokka/basic_auth/version.rb
|
60
|
+
- lokka-basic_auth.gemspec
|
61
|
+
homepage: http://lokka.org/
|
62
|
+
licenses: []
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
segments:
|
74
|
+
- 0
|
75
|
+
hash: 1499966196544056635
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ! '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
segments:
|
83
|
+
- 0
|
84
|
+
hash: 1499966196544056635
|
85
|
+
requirements: []
|
86
|
+
rubyforge_project: lokka-basic_auth
|
87
|
+
rubygems_version: 1.8.10
|
88
|
+
signing_key:
|
89
|
+
specification_version: 3
|
90
|
+
summary: Basic authentication plugin for Lokka.
|
91
|
+
test_files: []
|