locomotive_basic_auth_plugin 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +6 -0
- data/README.textile +39 -0
- data/lib/locomotive/basic_auth/plugin.rb +45 -0
- data/lib/locomotive/basic_auth/plugin/config.haml +13 -0
- data/lib/locomotive/basic_auth/plugin/version.rb +6 -0
- metadata +90 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
M2UxYTJlMjFmZTE2ZmI2Zjc5OWE1YzJhYTdkN2I1ZDU5OTc0OTYzNQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MTExZDQwNDAxNjRmM2RhYTI1YWJkZTkzMWI5YWNjZTExYWViM2MwNg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MDUxMDY0MjEyODk0MzYwYjU3YWYyMTcyODc1Y2ExMjgzZmZlNDFmNjdmZTFh
|
10
|
+
N2NmODkwNjQ0NDZkMTZkZmQzZGIyMGY4OTlhNmZmZjdlMzFhZTNlZTAwYTJi
|
11
|
+
YWFjMWNmYzQ1NzBhNWQ0NTE2NTU5OTZjNDUzNDY1Y2Y1MGQxNTY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NGQ2YjUxMTUwOTZhNDdmZTI1ZTAyYjJmOTUxYzZlOTY3MzYxNzY4Nzc3MmIy
|
14
|
+
ZTY4Nzk2ZDUwZjc5NWM5ZDhlYzJjZWQ0MTc4MWU4NjZmNjExZDQyMTYwMDAy
|
15
|
+
MjhhM2MxZTU0NTNhNzg3MGFkMTIwMjgyMjU5MTI5Yzg3OGJkN2I=
|
data/Gemfile
ADDED
data/README.textile
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
h1. Basic Auth Plugin
|
2
|
+
|
3
|
+
This is a plugin for LocomotiveCMS. It was created to allow LocomotiveCMS designers to add basic auth to specific pages.
|
4
|
+
|
5
|
+
h2. Installation
|
6
|
+
|
7
|
+
To use this plugin you must be using a version of LocomotiveCMS that has the plugins feature designed by "Colibri Software":https://www.colibri-software.com. You can do this by making the following changes to the Gemfile in you app:
|
8
|
+
|
9
|
+
* Remove or comment out the following line:
|
10
|
+
@gem 'locomotive_cms', '~> 2.X.X', require: 'locomotive/engine'@
|
11
|
+
* Add the following line:
|
12
|
+
@gem 'locomotive_cms', require: 'locomotive/engine', git: 'https://github.com/colibri-software/locomotive_engine.git', branch: 'plugins'@
|
13
|
+
|
14
|
+
Then add the following lines in your Gemfile to include the plugin:
|
15
|
+
<pre><code>group :locomotive_plugins do
|
16
|
+
gem 'locomotive_basic_auth_plugin'
|
17
|
+
end</code></pre>
|
18
|
+
|
19
|
+
h2. Usage
|
20
|
+
|
21
|
+
h3. Configuring Plugin
|
22
|
+
|
23
|
+
This plugin provides a configuration menu to setup the basic auth. The following are the avaiable options:
|
24
|
+
|
25
|
+
* Login - the login name to be used
|
26
|
+
* Password - The password to be used
|
27
|
+
* Page fullpath regexp - a regexp that matches all the pages that need to be secured with basic auth
|
28
|
+
|
29
|
+
h3. Liquid Drops
|
30
|
+
|
31
|
+
No liquid drops are provided
|
32
|
+
|
33
|
+
h3. Liquid Tags
|
34
|
+
|
35
|
+
No liquid tags are provided
|
36
|
+
|
37
|
+
h3. Liquid Filters
|
38
|
+
|
39
|
+
No liquid filters are provided
|
@@ -0,0 +1,45 @@
|
|
1
|
+
|
2
|
+
require 'rubygems'
|
3
|
+
require 'bundler/setup'
|
4
|
+
|
5
|
+
require 'locomotive_plugins'
|
6
|
+
|
7
|
+
# This is a quick-and-dirty basic authentication plugin. The login string and
|
8
|
+
# password are stored in plaintext in the config hash, so it is not secure. The
|
9
|
+
# configuration also takes a regular expression which specifies the page
|
10
|
+
# fullpaths which require basic authentication
|
11
|
+
module Locomotive
|
12
|
+
module BasicAuth
|
13
|
+
class Plugin
|
14
|
+
|
15
|
+
include Locomotive::Plugin
|
16
|
+
|
17
|
+
before_page_render :authenticate_if_needed
|
18
|
+
|
19
|
+
def config_template_file
|
20
|
+
File.join(File.dirname(__FILE__), 'plugin', 'config.haml')
|
21
|
+
end
|
22
|
+
|
23
|
+
def authenticate_if_needed
|
24
|
+
authenticate if need_to_authenticate?
|
25
|
+
end
|
26
|
+
|
27
|
+
protected
|
28
|
+
|
29
|
+
def authenticate
|
30
|
+
controller.authenticate_or_request_with_http_basic do |username, password|
|
31
|
+
username == config['login'] && password == config['password']
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def need_to_authenticate?
|
36
|
+
fullpath =~ Regexp.new(config['fullpath_regex'])
|
37
|
+
end
|
38
|
+
|
39
|
+
def fullpath
|
40
|
+
controller.params['path'] || ''
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
%li
|
3
|
+
%label{ name: 'login' } Login:
|
4
|
+
%input{ type: 'text', name: 'login' }
|
5
|
+
|
6
|
+
%li
|
7
|
+
%label{ name: 'password' } Password:
|
8
|
+
%input{ type: 'password', name: 'password' }
|
9
|
+
|
10
|
+
%li
|
11
|
+
%label{ name: 'fullpath_regex' } Page fullpath regex:
|
12
|
+
%input{ type: 'text', name: 'fullpath_regex' }
|
13
|
+
%p.inline-hints Do not include leading or trailing slashes
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: locomotive_basic_auth_plugin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Colibri Software
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: locomotive_plugins
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.12'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.12'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: mocha
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.13'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.13'
|
55
|
+
description: Locomotive plugin for adding basic authentication to pages of a site
|
56
|
+
email: info@colibri-software.com
|
57
|
+
executables: []
|
58
|
+
extensions: []
|
59
|
+
extra_rdoc_files: []
|
60
|
+
files:
|
61
|
+
- Gemfile
|
62
|
+
- README.textile
|
63
|
+
- lib/locomotive/basic_auth/plugin.rb
|
64
|
+
- lib/locomotive/basic_auth/plugin/config.haml
|
65
|
+
- lib/locomotive/basic_auth/plugin/version.rb
|
66
|
+
homepage: http://www.colibri-software.com
|
67
|
+
licenses:
|
68
|
+
- MIT
|
69
|
+
metadata: {}
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options: []
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 1.3.6
|
84
|
+
requirements: []
|
85
|
+
rubyforge_project:
|
86
|
+
rubygems_version: 2.2.2
|
87
|
+
signing_key:
|
88
|
+
specification_version: 4
|
89
|
+
summary: Locomotive plugin for adding basic authentication to pages of a site
|
90
|
+
test_files: []
|