katalyst-koi 4.16.0 → 4.17.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.
@@ -1,3 +1,4 @@
1
+ @use "sass:meta";
1
2
  @use "sass:string";
2
3
  @use "../utils/typography";
3
4
 
@@ -77,7 +78,7 @@ $text-icon-color: #888;
77
78
  }
78
79
 
79
80
  li.suggestion.attribute::before {
80
- background: url("data:image/svg+xml,%3Csvg width='14' height='16' viewBox='0 0 14 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 3.1C13 4.2598 10.3137 5.2 7 5.2C3.68629 5.2 1 4.2598 1 3.1M13 3.1C13 1.9402 10.3137 1 7 1C3.68629 1 1 1.9402 1 3.1M13 3.1V12.9C13 14.062 10.3333 15 7 15C3.66667 15 1 14.062 1 12.9V3.1M13 8C13 9.162 10.3333 10.1 7 10.1C3.66667 10.1 1 9.162 1 8' stroke='%23#{string.slice(inspect($text-icon-color), 2)}' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A")
81
+ background: url("data:image/svg+xml,%3Csvg width='14' height='16' viewBox='0 0 14 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 3.1C13 4.2598 10.3137 5.2 7 5.2C3.68629 5.2 1 4.2598 1 3.1M13 3.1C13 1.9402 10.3137 1 7 1C3.68629 1 1 1.9402 1 3.1M13 3.1V12.9C13 14.062 10.3333 15 7 15C3.66667 15 1 14.062 1 12.9V3.1M13 8C13 9.162 10.3333 10.1 7 10.1C3.66667 10.1 1 9.162 1 8' stroke='%23#{string.slice(meta.inspect($text-icon-color), 2)}' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A")
81
82
  no-repeat;
82
83
  top: 2px;
83
84
  }
@@ -85,13 +86,13 @@ $text-icon-color: #888;
85
86
  li.suggestion.database_value::before,
86
87
  li.suggestion.constant_value::before,
87
88
  li.suggestion.custom_value::before {
88
- background: url("data:image/svg+xml,%3Csvg width='14' height='16' viewBox='0 0 16 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.6111 5.16702L7.99998 8.99998M7.99998 8.99998L1.38886 5.16702M7.99998 8.99998L8 16.711M15 12.2943V5.70573C15 5.42761 15 5.28856 14.9607 5.16453C14.926 5.05481 14.8692 4.9541 14.7942 4.86912C14.7094 4.77307 14.5929 4.70553 14.3599 4.57047L8.60436 1.23354C8.38378 1.10565 8.27348 1.04171 8.15668 1.01664C8.05331 0.994453 7.94669 0.994453 7.84332 1.01664C7.72652 1.04171 7.61623 1.10565 7.39564 1.23354L1.64009 4.57047C1.40713 4.70554 1.29064 4.77307 1.20583 4.86912C1.13079 4.9541 1.074 5.05481 1.03927 5.16453C1 5.28856 1 5.42762 1 5.70573V12.2943C1 12.5724 1 12.7114 1.03927 12.8355C1.074 12.9452 1.13079 13.0459 1.20583 13.1309C1.29064 13.2269 1.40713 13.2945 1.64009 13.4295L7.39564 16.7665C7.61623 16.8943 7.72652 16.9583 7.84332 16.9834C7.94669 17.0055 8.05331 17.0055 8.15668 16.9834C8.27348 16.9583 8.38377 16.8943 8.60436 16.7665L14.3599 13.4295C14.5929 13.2945 14.7094 13.2269 14.7942 13.1309C14.8692 13.0459 14.926 12.9452 14.9607 12.8355C15 12.7114 15 12.5724 15 12.2943Z' stroke='%23#{string.slice(inspect($text-icon-color), 2)}' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A")
89
+ background: url("data:image/svg+xml,%3Csvg width='14' height='16' viewBox='0 0 16 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.6111 5.16702L7.99998 8.99998M7.99998 8.99998L1.38886 5.16702M7.99998 8.99998L8 16.711M15 12.2943V5.70573C15 5.42761 15 5.28856 14.9607 5.16453C14.926 5.05481 14.8692 4.9541 14.7942 4.86912C14.7094 4.77307 14.5929 4.70553 14.3599 4.57047L8.60436 1.23354C8.38378 1.10565 8.27348 1.04171 8.15668 1.01664C8.05331 0.994453 7.94669 0.994453 7.84332 1.01664C7.72652 1.04171 7.61623 1.10565 7.39564 1.23354L1.64009 4.57047C1.40713 4.70554 1.29064 4.77307 1.20583 4.86912C1.13079 4.9541 1.074 5.05481 1.03927 5.16453C1 5.28856 1 5.42762 1 5.70573V12.2943C1 12.5724 1 12.7114 1.03927 12.8355C1.074 12.9452 1.13079 13.0459 1.20583 13.1309C1.29064 13.2269 1.40713 13.2945 1.64009 13.4295L7.39564 16.7665C7.61623 16.8943 7.72652 16.9583 7.84332 16.9834C7.94669 17.0055 8.05331 17.0055 8.15668 16.9834C8.27348 16.9583 8.38377 16.8943 8.60436 16.7665L14.3599 13.4295C14.5929 13.2945 14.7094 13.2269 14.7942 13.1309C14.8692 13.0459 14.926 12.9452 14.9607 12.8355C15 12.7114 15 12.5724 15 12.2943Z' stroke='%23#{string.slice(meta.inspect($text-icon-color), 2)}' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A")
89
90
  no-repeat;
90
91
  top: 2px;
91
92
  }
92
93
 
93
94
  li.suggestion.search_value::before {
94
- background: url("data:image/svg+xml,%3Csvg width='14' height='16' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21 21L15.0001 15M17 10C17 13.866 13.866 17 10 17C6.13401 17 3 13.866 3 10C3 6.13401 6.13401 3 10 3C13.866 3 17 6.13401 17 10Z' stroke='%23#{string.slice(inspect($text-icon-color), 2)}' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A")
95
+ background: url("data:image/svg+xml,%3Csvg width='14' height='16' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21 21L15.0001 15M17 10C17 13.866 13.866 17 10 17C6.13401 17 3 13.866 3 10C3 6.13401 6.13401 3 10 3C13.866 3 17 6.13401 17 10Z' stroke='%23#{string.slice(meta.inspect($text-icon-color), 2)}' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A")
95
96
  no-repeat;
96
97
  top: 2px;
97
98
  }
@@ -1,30 +1,34 @@
1
- @mixin list($separator, $space: 1rem) {
1
+ $inset: 2rem !default;
2
+
3
+ $title: 4rem;
4
+ $breadcrumbs: 3rem;
5
+ $actions: 3rem;
6
+ $height: $title + $breadcrumbs + $actions;
7
+
8
+ @mixin list($separator, $margin: 1em, $padding: 0.5em) {
2
9
  display: flex;
10
+ align-items: center;
3
11
  list-style-position: outside;
12
+ margin-inline: $inset;
4
13
 
5
14
  > * {
6
15
  display: list-item;
7
- margin-left: $space;
16
+ margin-inline-start: $margin;
17
+ padding-inline-start: $padding;
8
18
  }
9
19
 
10
20
  > *::marker {
11
- content: " " + $separator + " ";
21
+ content: $separator;
12
22
  color: rgba(0, 0, 0, 0.4);
13
23
  }
14
24
 
15
25
  > *:first-child {
16
26
  display: block;
17
- margin-left: 0;
27
+ margin-inline-start: 0;
28
+ padding-inline-start: 0;
18
29
  }
19
30
  }
20
31
 
21
- $inset: 2rem !default;
22
-
23
- $title: 4rem;
24
- $breadcrumbs: 3rem;
25
- $actions: 3rem;
26
- $height: $title + $breadcrumbs + $actions;
27
-
28
32
  %header {
29
33
  border-bottom: 1px solid #ececec;
30
34
  color: #b2b2b2;
@@ -44,20 +48,14 @@ $height: $title + $breadcrumbs + $actions;
44
48
 
45
49
  .breadcrumbs {
46
50
  grid-area: breadcrumbs;
47
- display: flex;
48
- align-items: center;
49
- margin: 0 $inset;
50
51
 
51
- @include list("› ", 1.2rem);
52
+ @include list("›");
52
53
  }
53
54
 
54
55
  .actions {
55
56
  grid-area: actions;
56
- display: flex;
57
- align-items: center;
58
- margin: 0 $inset;
57
+ gap: 0;
59
58
 
60
- @include list("|", 0.5rem);
61
- list-style-type: square;
59
+ @include list("|", $margin: 0.8em);
62
60
  }
63
61
  }
@@ -11,7 +11,7 @@
11
11
 
12
12
  .admin-login > main {
13
13
  flex: 1 1 auto;
14
- max-width: 20rem;
14
+ max-width: 24rem;
15
15
  background: white;
16
16
  border-radius: 0.25rem;
17
17
  height: unset;
@@ -1,42 +1,24 @@
1
1
  @use "../utils/typography" as *;
2
2
 
3
- @function govuk-definition($size) {
4
- @return (
5
- null: (
6
- font-size: font-size($size, mobile, px),
7
- line-height: line-height($size, mobile, px),
8
- ),
9
- tablet: (
10
- font-size: font-size($size, tablet, px),
11
- line-height: line-height($size, tablet, px),
12
- ),
13
- print: (
14
- font-size: font-size($size, print, px),
15
- line-height: line-height($size, print, px),
16
- )
17
- );
18
- }
19
-
20
- $govuk-font-family: "Inter";
21
- $govuk-text-colour: #{var(--site-text-color)};
22
- $govuk-typography-scale: (
23
- 80: govuk-definition(h1),
24
- 48: govuk-definition(h2),
25
- 36: govuk-definition(h3),
26
- 27: govuk-definition(h4),
27
- 24: govuk-definition(h5),
28
- 19: govuk-definition(h6),
29
- 16: govuk-definition(paragraph),
30
- 14: govuk-definition(small),
3
+ @use "katalyst/govuk/formbuilder" with (
4
+ $govuk-font-family: "Inter",
5
+ $govuk-text-colour: #{var(--site-text-color)},
6
+ $govuk-typography-scale: (
7
+ 80: govuk-definition(h1),
8
+ 48: govuk-definition(h2),
9
+ 36: govuk-definition(h3),
10
+ 27: govuk-definition(h4),
11
+ 24: govuk-definition(h5),
12
+ 19: govuk-definition(h6),
13
+ 16: govuk-definition(paragraph),
14
+ 14: govuk-definition(small),
15
+ ),
16
+ $govuk-input-border-colour: #{var(--site-text-color)}
31
17
  );
32
18
 
33
- $govuk-input-border-colour: #{var(--site-text-color)};
34
-
35
- @import "katalyst/govuk/formbuilder";
36
-
37
19
  .govuk-input,
38
20
  .govuk-textarea {
39
- color: $govuk-text-colour;
21
+ color: var(--site-text-color);
40
22
  }
41
23
 
42
24
  .govuk-hint {
@@ -50,3 +32,25 @@ $govuk-input-border-colour: #{var(--site-text-color)};
50
32
  margin-left: -18px;
51
33
  padding-left: 13px;
52
34
  }
35
+
36
+ // add some koi styling to the govuk show/hide password button
37
+ [data-govuk-password-input-init] {
38
+ max-width: var(--text-width);
39
+
40
+ .govuk-password-input__wrapper {
41
+ gap: 0.5rem;
42
+ }
43
+
44
+ .govuk-button {
45
+ min-width: 4em;
46
+ background: none;
47
+ cursor: pointer;
48
+ border: 2px solid var(--site-text-color);
49
+ }
50
+
51
+ .govuk-button:focus-visible,
52
+ .govuk-button:hover {
53
+ color: var(--site-primary);
54
+ border-color: var(--site-primary);
55
+ }
56
+ }
@@ -1,10 +1,11 @@
1
+ @use "sass:map";
1
2
  @use "sass:math";
2
3
 
3
4
  $-font-sizes: () !default;
4
5
  $-line-heights: () !default;
5
6
 
6
7
  @function font-size($size, $breakpoint: null, $unit: rem) {
7
- $font-size: map-get($-font-sizes, $size);
8
+ $font-size: map.get($-font-sizes, $size);
8
9
 
9
10
  @if $unit == rem {
10
11
  @return $font-size;
@@ -14,7 +15,7 @@ $-line-heights: () !default;
14
15
  }
15
16
 
16
17
  @function line-height($size, $breakpoint: null, $unit: em) {
17
- $line-height: map-get($-line-heights, $size);
18
+ $line-height: map.get($-line-heights, $size);
18
19
 
19
20
  @if $unit == em {
20
21
  @return $line-height;
@@ -22,3 +23,20 @@ $-line-heights: () !default;
22
23
  @return math.div($line-height, 1em) * 16px;
23
24
  }
24
25
  }
26
+
27
+ @function govuk-definition($size) {
28
+ @return (
29
+ null: (
30
+ font-size: font-size($size, mobile, px),
31
+ line-height: line-height($size, mobile, px),
32
+ ),
33
+ tablet: (
34
+ font-size: font-size($size, tablet, px),
35
+ line-height: line-height($size, tablet, px),
36
+ ),
37
+ print: (
38
+ font-size: font-size($size, print, px),
39
+ line-height: line-height($size, print, px),
40
+ )
41
+ );
42
+ }
@@ -3,6 +3,7 @@
3
3
  module Admin
4
4
  class SessionsController < ApplicationController
5
5
  include Koi::Controller::HasWebauthn
6
+ include Koi::Controller::RecordsAuthentication
6
7
 
7
8
  before_action :redirect_authenticated, only: %i[new], if: :admin_signed_in?
8
9
  before_action :authenticate_local_admin, only: %i[new], if: :authenticate_local_admins?
@@ -104,33 +105,5 @@ module Admin
104
105
  def session_params
105
106
  params.expect(admin: %i[email password token response])
106
107
  end
107
-
108
- def update_last_sign_in(admin_user)
109
- return if admin_user.current_sign_in_at.blank?
110
-
111
- admin_user.last_sign_in_at = admin_user.current_sign_in_at
112
- admin_user.last_sign_in_ip = admin_user.current_sign_in_ip
113
- end
114
-
115
- def record_sign_in!(admin_user)
116
- update_last_sign_in(admin_user)
117
-
118
- admin_user.current_sign_in_at = Time.current
119
- admin_user.current_sign_in_ip = request.remote_ip
120
- admin_user.sign_in_count = admin_user.sign_in_count + 1
121
-
122
- admin_user.save!
123
- end
124
-
125
- def record_sign_out!(admin_user)
126
- return unless admin_user
127
-
128
- update_last_sign_in(admin_user)
129
-
130
- admin_user.current_sign_in_at = nil
131
- admin_user.current_sign_in_ip = nil
132
-
133
- admin_user.save!
134
- end
135
108
  end
136
109
  end
@@ -2,66 +2,40 @@
2
2
 
3
3
  module Admin
4
4
  class TokensController < ApplicationController
5
- include Koi::Controller::JsonWebToken
5
+ include Koi::Controller::RecordsAuthentication
6
6
 
7
- before_action :set_admin, only: %i[create]
8
- before_action :set_token, only: %i[show update]
9
- before_action :invalid_token, only: %i[show update], unless: :token_valid?
7
+ before_action :set_admin_user, only: %i[create]
8
+
9
+ attr_reader :admin_user
10
10
 
11
11
  def show
12
- render locals: { admin: @admin, token: params[:token] }, layout: "koi/login"
12
+ if (@admin_user = Admin::User.find_by_token_for(:password_reset, params[:token]))
13
+ render locals: { admin_user:, token: params[:token] }, layout: "koi/login"
14
+ else
15
+ redirect_to(new_admin_session_path, status: :see_other, notice: I18n.t("koi.auth.token_invalid"))
16
+ end
13
17
  end
14
18
 
15
19
  def create
16
- token = encode_token(admin_id: @admin.id, exp: 30.minutes.from_now.to_i, iat: Time.current.to_i)
17
-
18
- render locals: { token: }
20
+ render locals: { token: admin_user.generate_token_for(:password_reset) }
19
21
  end
20
22
 
21
23
  def update
22
- sign_in_admin(@admin)
23
-
24
- redirect_to admin_admin_user_path(@admin), status: :see_other, notice: t("koi.auth.token_consumed")
25
- end
26
-
27
- private
24
+ if (@admin_user = Admin::User.find_by_token_for(:password_reset, params[:token]))
25
+ record_sign_in!(admin_user)
28
26
 
29
- def set_admin
30
- @admin = Admin::User.find(params[:admin_user_id])
31
- end
32
-
33
- def set_token
34
- @token = decode_token(params[:token])
35
-
36
- # constant time token validation requires that we always try to retrieve a user
37
- @admin = Admin::User.find_by(id: @token&.fetch(:admin_id) || "")
38
- end
27
+ session[:admin_user_id] = admin_user.id
39
28
 
40
- def token_valid?
41
- return false unless @token.present? && @admin.present?
42
-
43
- # Ensure that the user has not signed in since the token was generated
44
- if @admin.current_sign_in_at.present?
45
- @admin.current_sign_in_at.to_i < @token[:iat]
46
- elsif @admin.last_sign_in_at.present?
47
- @admin.last_sign_in_at.to_i < @token[:iat]
29
+ redirect_to admin_admin_user_path(admin_user), status: :see_other, notice: t("koi.auth.token_consumed")
48
30
  else
49
- true # first sign in
31
+ redirect_to(new_admin_session_path, status: :see_other, notice: I18n.t("koi.auth.token_invalid"))
50
32
  end
51
33
  end
52
34
 
53
- def invalid_token
54
- redirect_to(new_admin_session_path, status: :see_other, notice: I18n.t("koi.auth.token_invalid"))
55
- end
56
-
57
- def sign_in_admin(admin)
58
- admin.current_sign_in_at = Time.current
59
- admin.current_sign_in_ip = request.remote_ip
60
- admin.sign_in_count = 1
35
+ private
61
36
 
62
- # disable validations to allow saving without password or passkey credentials
63
- admin.save!(validate: false)
64
- session[:admin_user_id] = admin.id
37
+ def set_admin_user
38
+ @admin_user = Admin::User.find(params[:admin_user_id])
65
39
  end
66
40
  end
67
41
  end
@@ -12,15 +12,14 @@ module Koi
12
12
  def webauthn_relying_party
13
13
  @webauthn_relying_party ||=
14
14
  WebAuthn::RelyingParty.new(
15
- name: Koi.config.admin_name,
16
- origin: request.base_url,
15
+ name: Koi.config.admin_name,
16
+ allowed_origins: [request.base_url],
17
17
  )
18
18
  end
19
19
 
20
20
  def webauthn_auth_options
21
- options = webauthn_relying_party.options_for_authentication(
22
- allow: Admin::Credential.pluck(:external_id),
23
- )
21
+ options = webauthn_relying_party.options_for_authentication
22
+
24
23
  session[:authentication_challenge] = options.challenge
25
24
 
26
25
  options
@@ -42,6 +41,8 @@ module Koi
42
41
  )
43
42
 
44
43
  stored_credential.admin
44
+ rescue ActiveRecord::RecordNotFound
45
+ false
45
46
  end
46
47
  end
47
48
  end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Koi
4
+ module Controller
5
+ module RecordsAuthentication
6
+ def update_last_sign_in(admin_user)
7
+ return if admin_user.current_sign_in_at.blank?
8
+
9
+ admin_user.last_sign_in_at = admin_user.current_sign_in_at
10
+ admin_user.last_sign_in_ip = admin_user.current_sign_in_ip
11
+ end
12
+
13
+ def record_sign_in!(admin_user)
14
+ update_last_sign_in(admin_user)
15
+
16
+ admin_user.current_sign_in_at = Time.current
17
+ admin_user.current_sign_in_ip = request.remote_ip
18
+ admin_user.sign_in_count += 1
19
+
20
+ admin_user.save!
21
+ end
22
+
23
+ def record_sign_out!(admin_user)
24
+ return unless admin_user
25
+
26
+ update_last_sign_in(admin_user)
27
+
28
+ admin_user.current_sign_in_at = nil
29
+ admin_user.current_sign_in_ip = nil
30
+
31
+ admin_user.save!
32
+ end
33
+ end
34
+ end
35
+ end
@@ -12,6 +12,8 @@ module Admin
12
12
  # disable validations for password_digest
13
13
  has_secure_password validations: false
14
14
 
15
+ generates_token_for(:password_reset, expires_in: 30.minutes) { current_sign_in_at }
16
+
15
17
  has_many :credentials, inverse_of: :admin, class_name: "Admin::Credential", dependent: :destroy
16
18
 
17
19
  validates :name, :email, presence: true
@@ -8,4 +8,7 @@
8
8
  <%= form.govuk_password_field :password, autofocus: true, autocomplete: "off" %>
9
9
  <%= hidden_field_tag(:redirect, params[:redirect]) %>
10
10
  <%= form.admin_save "Next" %>
11
+
12
+ <%# init govuk js to provide the show/hide button %>
13
+ <%= govuk_formbuilder_init %>
11
14
  <% end %>
@@ -1,3 +1,5 @@
1
+ <%# locals: (token:) %>
2
+
1
3
  <%= turbo_stream.replace "invite" do %>
2
4
  <div class="action copy-to-clipboard govuk-input__wrapper" data-controller="clipboard" data-clipboard-supported-class="clipboard--supported">
3
5
  <%= text_field_tag :invite_link, admin_session_token_url(token), readonly: true, data: { clipboard_target: "source" } %>
@@ -1,8 +1,10 @@
1
+ <%# locals: (admin_user:, token:) %>
2
+
1
3
  <%= render "layouts/koi/navigation_header" %>
2
4
 
3
5
  <%= form_with(url: admin_session_token_path(token), method: :patch) do |form| %>
4
6
  <p>Welcome to Koi Admin</p>
5
- <%= render Koi::SummaryListComponent.new(model: admin, class: "item-table") do |builder| %>
7
+ <%= render Koi::SummaryListComponent.new(model: admin_user, class: "item-table") do |builder| %>
6
8
  <%= builder.text :name %>
7
9
  <%= builder.text :email %>
8
10
  <% end %>
@@ -27,7 +27,8 @@ module Koi
27
27
 
28
28
  def add_navigation
29
29
  gsub_file("config/initializers/koi.rb", /Koi::Menu.modules = ({}|{\n(?:\s+.*\n)*})\n/) do |match|
30
- config = eval(match) # rubocop:disable Security/Eval # we know that this only during generation
30
+ # Safe because we know that this only called during code generation
31
+ config = eval(match) # rubocop:disable Security/Eval
31
32
  label = [*regular_class_path.map(&:humanize), human_name.pluralize].join(" ")
32
33
  path = "/admin#{route_url}"
33
34
  config[label] = path
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: katalyst-koi
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.16.0
4
+ version: 4.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katalyst Interactive
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-02-04 00:00:00.000000000 Z
10
+ date: 2025-02-27 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails
@@ -113,14 +113,14 @@ dependencies:
113
113
  requirements:
114
114
  - - ">="
115
115
  - !ruby/object:Gem::Version
116
- version: '0'
116
+ version: 3.4.0
117
117
  type: :runtime
118
118
  prerelease: false
119
119
  version_requirements: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - ">="
122
122
  - !ruby/object:Gem::Version
123
- version: '0'
123
+ version: 3.4.0
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: katalyst-govuk-formbuilder
126
126
  requirement: !ruby/object:Gem::Requirement
@@ -378,7 +378,7 @@ files:
378
378
  - app/controllers/concerns/koi/controller/has_attachments.rb
379
379
  - app/controllers/concerns/koi/controller/has_webauthn.rb
380
380
  - app/controllers/concerns/koi/controller/is_admin_controller.rb
381
- - app/controllers/concerns/koi/controller/json_web_token.rb
381
+ - app/controllers/concerns/koi/controller/records_authentication.rb
382
382
  - app/controllers/well_knowns_controller.rb
383
383
  - app/helpers/koi/application_helper.rb
384
384
  - app/helpers/koi/date_helper.rb
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Koi
4
- module Controller
5
- module JsonWebToken
6
- extend ActiveSupport::Concern
7
-
8
- SECRET_KEY = Rails.application.secret_key_base
9
-
10
- def encode_token(**payload)
11
- JWT.encode(payload, SECRET_KEY)
12
- end
13
-
14
- def decode_token(token)
15
- payload = JWT.decode(token, SECRET_KEY)[0]
16
- ActiveSupport::HashWithIndifferentAccess.new(payload)
17
- rescue JWT::DecodeError
18
- nil
19
- end
20
- end
21
- end
22
- end