himari 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -0
- data/lib/himari/app.rb +20 -2
- data/lib/himari/config.rb +6 -2
- data/lib/himari/version.rb +1 -1
- data/public/public/index.css +2 -2
- data/views/login.erb +14 -4
- metadata +3 -6
- data/Gemfile +0 -11
- data/Gemfile.lock +0 -152
- data/himari.gemspec +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ac0941b925171e38c0862b97f8a0ad2256c9ac56cfc3d3dd9b59bca1508dc4e
|
4
|
+
data.tar.gz: 37b2fc9399deca00071f07140c53aac84a8deb6169c9cb11f919d34388dae217
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0513156a600ffe7a0364ab2c7da45153702afce8c0fd82caf2c6f697529793570f61280abe50316ae5dd491c49908a084fe8d8341ef0a8882a4c5fee5eaf954
|
7
|
+
data.tar.gz: 5b63f0a995ebc2be40440d02831c2bbb40d8928277b3e181ffc0d227546274af0d6fee26f26f4cea9dd90578095b8023c9830973e5d39205273e4a1c7f2633d0
|
data/Rakefile
CHANGED
data/lib/himari/app.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
require 'sinatra/base'
|
2
2
|
require 'addressable'
|
3
|
+
require 'base64'
|
4
|
+
|
5
|
+
require 'himari/version'
|
3
6
|
|
4
7
|
require 'himari/log_line'
|
5
8
|
|
@@ -66,7 +69,16 @@ module Himari
|
|
66
69
|
end
|
67
70
|
|
68
71
|
def cachebuster
|
69
|
-
env['himari.cachebuster']
|
72
|
+
env['himari.cachebuster'] ||= Base64.urlsafe_encode64(release_code, padding: false)
|
73
|
+
end
|
74
|
+
|
75
|
+
def release_code
|
76
|
+
env['himari.release'] ||= begin
|
77
|
+
[
|
78
|
+
Himari::VERSION,
|
79
|
+
config.release_fragment,
|
80
|
+
].compact.join(':')
|
81
|
+
end
|
70
82
|
end
|
71
83
|
|
72
84
|
def request_id
|
@@ -83,6 +95,12 @@ module Himari
|
|
83
95
|
xff: env['HTTP_X_FORWARDED_FOR'],
|
84
96
|
}
|
85
97
|
end
|
98
|
+
|
99
|
+
def msg(key, default = nil)
|
100
|
+
config.custom_messages[key] || default
|
101
|
+
end
|
102
|
+
|
103
|
+
include ERB::Util
|
86
104
|
end
|
87
105
|
|
88
106
|
before do
|
@@ -119,7 +137,7 @@ module Himari
|
|
119
137
|
).call(env)
|
120
138
|
else
|
121
139
|
logger&.info(Himari::LogLine.new('authorize: prompt login', req: request_as_log, client_id: params[:client_id]))
|
122
|
-
erb :login
|
140
|
+
erb config.custom_templates[:login] || :login
|
123
141
|
end
|
124
142
|
rescue Himari::Services::DownstreamAuthorization::ForbiddenError => e
|
125
143
|
logger&.warn(Himari::LogLine.new('authorize: downstream forbidden', req: request_as_log, allowed: e.result.authz_result.allowed, err: e.class.inspect, result: e.as_log))
|
data/lib/himari/config.rb
CHANGED
@@ -5,7 +5,7 @@ require 'himari/log_line'
|
|
5
5
|
|
6
6
|
module Himari
|
7
7
|
class Config
|
8
|
-
def initialize(issuer:, storage:, providers: [], log_output: $stdout, log_level: Logger::INFO, preserve_rack_logger: false)
|
8
|
+
def initialize(issuer:, storage:, providers: [], log_output: $stdout, log_level: Logger::INFO, preserve_rack_logger: false, custom_templates: {}, custom_messages: {}, release_fragment: nil)
|
9
9
|
@issuer = issuer
|
10
10
|
@providers = providers
|
11
11
|
@storage = storage
|
@@ -13,9 +13,13 @@ module Himari
|
|
13
13
|
@log_output = log_output
|
14
14
|
@log_level = log_level
|
15
15
|
@preserve_rack_logger = preserve_rack_logger
|
16
|
+
|
17
|
+
@custom_messages = custom_messages
|
18
|
+
@custom_templates = custom_templates
|
19
|
+
@release_fragment = release_fragment
|
16
20
|
end
|
17
21
|
|
18
|
-
attr_reader :issuer, :providers, :storage, :preserve_rack_logger
|
22
|
+
attr_reader :issuer, :providers, :storage, :preserve_rack_logger, :custom_messages, :custom_templates, :release_fragment
|
19
23
|
|
20
24
|
def logger
|
21
25
|
@logger ||= Logger.new(@log_output).tap do |l|
|
data/lib/himari/version.rb
CHANGED
data/public/public/index.css
CHANGED
data/views/login.erb
CHANGED
@@ -2,16 +2,22 @@
|
|
2
2
|
<html lang="en">
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8">
|
5
|
-
<title
|
6
|
-
<link rel="stylesheet" href="/public/index.css?
|
5
|
+
<title><%= h(msg(:page_title, nil) || msg(:title, "Login to Himari")) %></title>
|
6
|
+
<link rel="stylesheet" href="/public/index.css?cb=<%= cachebuster %>" type="text/css" />
|
7
7
|
<meta name="viewport" content="initial-scale=1">
|
8
8
|
<meta name="robots" content="noindex, nofollow">
|
9
9
|
|
10
|
-
<meta name="himari:release" content="
|
10
|
+
<meta name="himari:release" content="<%= release_code %>">
|
11
11
|
</head>
|
12
12
|
|
13
|
-
<body class='himari-app himari-
|
13
|
+
<body class='himari-app himari-login'>
|
14
14
|
<main>
|
15
|
+
|
16
|
+
<header>
|
17
|
+
<h1><%= msg(:title, "Login to Himari") %></h1>
|
18
|
+
<%= msg(:header) %>
|
19
|
+
</header>
|
20
|
+
|
15
21
|
<nav class='actions'>
|
16
22
|
<fieldset id='actions-fieldset'>
|
17
23
|
<% known_providers.each do |provider| %>
|
@@ -22,6 +28,10 @@
|
|
22
28
|
<% end %>
|
23
29
|
</fieldset>
|
24
30
|
</nav>
|
31
|
+
|
32
|
+
<footer>
|
33
|
+
<%= msg(:footer) %>
|
34
|
+
</footer>
|
25
35
|
</main>
|
26
36
|
|
27
37
|
<script type='text/javascript'>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: himari
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sorah Fukumori
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -102,11 +102,8 @@ extensions: []
|
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
104
|
- ".rspec"
|
105
|
-
- Gemfile
|
106
|
-
- Gemfile.lock
|
107
105
|
- LICENSE.txt
|
108
106
|
- Rakefile
|
109
|
-
- himari.gemspec
|
110
107
|
- lib/himari.rb
|
111
108
|
- lib/himari/access_token.rb
|
112
109
|
- lib/himari/app.rb
|
@@ -167,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
164
|
- !ruby/object:Gem::Version
|
168
165
|
version: '0'
|
169
166
|
requirements: []
|
170
|
-
rubygems_version: 3.
|
167
|
+
rubygems_version: 3.1.6
|
171
168
|
signing_key:
|
172
169
|
specification_version: 4
|
173
170
|
summary: Small OIDC IdP for small teams - Omniauth to OIDC
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,152 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
himari (0.1.0)
|
5
|
-
addressable
|
6
|
-
omniauth (>= 2.0)
|
7
|
-
openid_connect
|
8
|
-
rack-oauth2
|
9
|
-
rack-protection
|
10
|
-
sinatra (>= 3.0)
|
11
|
-
|
12
|
-
GEM
|
13
|
-
remote: https://rubygems.org/
|
14
|
-
specs:
|
15
|
-
activemodel (7.0.4.3)
|
16
|
-
activesupport (= 7.0.4.3)
|
17
|
-
activesupport (7.0.4.3)
|
18
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
19
|
-
i18n (>= 1.6, < 2)
|
20
|
-
minitest (>= 5.1)
|
21
|
-
tzinfo (~> 2.0)
|
22
|
-
addressable (2.8.1)
|
23
|
-
public_suffix (>= 2.0.2, < 6.0)
|
24
|
-
aes_key_wrap (1.1.0)
|
25
|
-
attr_required (1.0.1)
|
26
|
-
bindata (2.4.15)
|
27
|
-
concurrent-ruby (1.2.2)
|
28
|
-
date (3.3.3)
|
29
|
-
diff-lcs (1.5.0)
|
30
|
-
docile (1.4.0)
|
31
|
-
faraday (2.7.4)
|
32
|
-
faraday-net_http (>= 2.0, < 3.1)
|
33
|
-
ruby2_keywords (>= 0.0.4)
|
34
|
-
faraday-follow_redirects (0.3.0)
|
35
|
-
faraday (>= 1, < 3)
|
36
|
-
faraday-net_http (3.0.2)
|
37
|
-
hashie (5.0.0)
|
38
|
-
i18n (1.12.0)
|
39
|
-
concurrent-ruby (~> 1.0)
|
40
|
-
json-jwt (1.16.3)
|
41
|
-
activesupport (>= 4.2)
|
42
|
-
aes_key_wrap
|
43
|
-
bindata
|
44
|
-
faraday (~> 2.0)
|
45
|
-
faraday-follow_redirects
|
46
|
-
mail (2.8.1)
|
47
|
-
mini_mime (>= 0.1.1)
|
48
|
-
net-imap
|
49
|
-
net-pop
|
50
|
-
net-smtp
|
51
|
-
mini_mime (1.1.2)
|
52
|
-
minitest (5.18.0)
|
53
|
-
mustermann (3.0.0)
|
54
|
-
ruby2_keywords (~> 0.0.1)
|
55
|
-
net-imap (0.3.4)
|
56
|
-
date
|
57
|
-
net-protocol
|
58
|
-
net-pop (0.1.2)
|
59
|
-
net-protocol
|
60
|
-
net-protocol (0.2.1)
|
61
|
-
timeout
|
62
|
-
net-smtp (0.3.3)
|
63
|
-
net-protocol
|
64
|
-
omniauth (2.1.1)
|
65
|
-
hashie (>= 3.4.6)
|
66
|
-
rack (>= 2.2.3)
|
67
|
-
rack-protection
|
68
|
-
openid_connect (2.2.0)
|
69
|
-
activemodel
|
70
|
-
attr_required (>= 1.0.0)
|
71
|
-
faraday (~> 2.0)
|
72
|
-
faraday-follow_redirects
|
73
|
-
json-jwt (>= 1.16)
|
74
|
-
net-smtp
|
75
|
-
rack-oauth2 (~> 2.2)
|
76
|
-
swd (~> 2.0)
|
77
|
-
tzinfo
|
78
|
-
validate_email
|
79
|
-
validate_url
|
80
|
-
webfinger (~> 2.0)
|
81
|
-
public_suffix (5.0.1)
|
82
|
-
rack (2.2.6.4)
|
83
|
-
rack-oauth2 (2.2.0)
|
84
|
-
activesupport
|
85
|
-
attr_required
|
86
|
-
faraday (~> 2.0)
|
87
|
-
faraday-follow_redirects
|
88
|
-
json-jwt (>= 1.11.0)
|
89
|
-
rack (>= 2.1.0)
|
90
|
-
rack-protection (3.0.5)
|
91
|
-
rack
|
92
|
-
rack-test (2.1.0)
|
93
|
-
rack (>= 1.3)
|
94
|
-
rake (13.0.6)
|
95
|
-
rspec (3.12.0)
|
96
|
-
rspec-core (~> 3.12.0)
|
97
|
-
rspec-expectations (~> 3.12.0)
|
98
|
-
rspec-mocks (~> 3.12.0)
|
99
|
-
rspec-core (3.12.1)
|
100
|
-
rspec-support (~> 3.12.0)
|
101
|
-
rspec-expectations (3.12.2)
|
102
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
103
|
-
rspec-support (~> 3.12.0)
|
104
|
-
rspec-mocks (3.12.4)
|
105
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
106
|
-
rspec-support (~> 3.12.0)
|
107
|
-
rspec-support (3.12.0)
|
108
|
-
ruby2_keywords (0.0.5)
|
109
|
-
simplecov (0.22.0)
|
110
|
-
docile (~> 1.1)
|
111
|
-
simplecov-html (~> 0.11)
|
112
|
-
simplecov_json_formatter (~> 0.1)
|
113
|
-
simplecov-html (0.12.3)
|
114
|
-
simplecov_json_formatter (0.1.4)
|
115
|
-
sinatra (3.0.5)
|
116
|
-
mustermann (~> 3.0)
|
117
|
-
rack (~> 2.2, >= 2.2.4)
|
118
|
-
rack-protection (= 3.0.5)
|
119
|
-
tilt (~> 2.0)
|
120
|
-
swd (2.0.2)
|
121
|
-
activesupport (>= 3)
|
122
|
-
attr_required (>= 0.0.5)
|
123
|
-
faraday (~> 2.0)
|
124
|
-
faraday-follow_redirects
|
125
|
-
tilt (2.1.0)
|
126
|
-
timeout (0.3.2)
|
127
|
-
tzinfo (2.0.6)
|
128
|
-
concurrent-ruby (~> 1.0)
|
129
|
-
validate_email (0.1.6)
|
130
|
-
activemodel (>= 3.0)
|
131
|
-
mail (>= 2.2.5)
|
132
|
-
validate_url (1.0.15)
|
133
|
-
activemodel (>= 3.0.0)
|
134
|
-
public_suffix
|
135
|
-
webfinger (2.1.2)
|
136
|
-
activesupport
|
137
|
-
faraday (~> 2.0)
|
138
|
-
faraday-follow_redirects
|
139
|
-
|
140
|
-
PLATFORMS
|
141
|
-
ruby
|
142
|
-
|
143
|
-
DEPENDENCIES
|
144
|
-
himari!
|
145
|
-
rack-test
|
146
|
-
rake
|
147
|
-
rspec
|
148
|
-
simplecov
|
149
|
-
simplecov-html
|
150
|
-
|
151
|
-
BUNDLED WITH
|
152
|
-
2.4.8
|
data/himari.gemspec
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "lib/himari/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "himari"
|
7
|
-
spec.version = Himari::VERSION
|
8
|
-
spec.authors = ["Sorah Fukumori"]
|
9
|
-
spec.email = ["her@sorah.jp"]
|
10
|
-
|
11
|
-
spec.summary = "Small OIDC IdP for small teams - Omniauth to OIDC"
|
12
|
-
spec.homepage = "https://github.com/sorah/himari"
|
13
|
-
spec.license = "MIT"
|
14
|
-
spec.required_ruby_version = ">= 2.7.0"
|
15
|
-
|
16
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
-
spec.metadata["source_code_uri"] = "https://github.com/sorah/himari"
|
18
|
-
|
19
|
-
# Specify which files should be added to the gem when it is released.
|
20
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
21
|
-
spec.files = Dir.chdir(__dir__) do
|
22
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
23
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
24
|
-
end
|
25
|
-
end
|
26
|
-
spec.bindir = "exe"
|
27
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
28
|
-
spec.require_paths = ["lib"]
|
29
|
-
|
30
|
-
spec.add_dependency "sinatra", '>= 3.0'
|
31
|
-
spec.add_dependency 'rack-protection'
|
32
|
-
spec.add_dependency "omniauth", ">= 2.0"
|
33
|
-
|
34
|
-
spec.add_dependency 'addressable'
|
35
|
-
|
36
|
-
spec.add_dependency "rack-oauth2"
|
37
|
-
spec.add_dependency "openid_connect"
|
38
|
-
|
39
|
-
# Uncomment to register a new dependency of your gem
|
40
|
-
# spec.add_dependency "example-gem", "~> 1.0"
|
41
|
-
|
42
|
-
# For more information and examples about making a new gem, check out our
|
43
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
44
|
-
end
|