Class: Gitlab::MailRoom::Authenticator
- Inherits:
-
Object
- Object
- Gitlab::MailRoom::Authenticator
show all
- Includes:
- JwtAuthenticatable
- Defined in:
- lib/gitlab/mail_room/authenticator.rb
Constant Summary
collapse
- SecretConfigurationError =
Class.new(StandardError)
- EXPIRATION =
Only allow token generated within the last 5 minutes
5.minutes
JwtAuthenticatable::SECRET_LENGTH
Class Method Summary
collapse
included
Class Method Details
.enabled_configs ⇒ Object
.secret(mailbox_type) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/gitlab/mail_room/authenticator.rb', line 30
def secret(mailbox_type)
strong_memoize("jwt_secret_#{mailbox_type}".to_sym) do
secret_path = enabled_configs[mailbox_type][:secret_file]
raise SecretConfigurationError, "#{mailbox_type}'s secret_file configuration is missing" if secret_path.blank?
begin
read_secret(secret_path)
rescue StandardError => e
raise SecretConfigurationError, "Fail to read #{mailbox_type}'s secret: #{e.message}"
end
end
end
|
.verify_api_request(request_headers, mailbox_type) ⇒ Object