Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
16470e3488
commit
0409f2aea9
4 changed files with 14 additions and 2 deletions
|
@ -14,7 +14,7 @@ module ApplicationSettingImplementation
|
|||
# Setting a key restriction to `-1` means that all keys of this type are
|
||||
# forbidden.
|
||||
FORBIDDEN_KEY_VALUE = KeyRestrictionValidator::FORBIDDEN
|
||||
SUPPORTED_KEY_TYPES = %i[rsa dsa ecdsa ed25519].freeze
|
||||
SUPPORTED_KEY_TYPES = Gitlab::SSHPublicKey.supported_types
|
||||
VALID_RUNNER_REGISTRAR_TYPES = %w(project group).freeze
|
||||
|
||||
DEFAULT_PROTECTED_PATHS = [
|
||||
|
|
|
@ -19,6 +19,10 @@ module Gitlab
|
|||
TECHNOLOGIES.find { |tech| key.is_a?(tech.key_class) }
|
||||
end
|
||||
|
||||
def self.supported_types
|
||||
TECHNOLOGIES.map(&:name)
|
||||
end
|
||||
|
||||
def self.supported_sizes(name)
|
||||
technology(name)&.supported_sizes
|
||||
end
|
||||
|
|
|
@ -21,6 +21,14 @@ RSpec.describe Gitlab::SSHPublicKey, lib: true do
|
|||
end
|
||||
end
|
||||
|
||||
describe '.supported_types' do
|
||||
it 'returns array with the names of supported technologies' do
|
||||
expect(described_class.supported_types).to eq(
|
||||
[:rsa, :dsa, :ecdsa, :ed25519]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe '.supported_sizes(name)' do
|
||||
where(:name, :sizes) do
|
||||
[
|
||||
|
|
|
@ -491,7 +491,7 @@ RSpec.describe ApplicationSetting do
|
|||
|
||||
context 'key restrictions' do
|
||||
it 'supports all key types' do
|
||||
expect(described_class::SUPPORTED_KEY_TYPES).to contain_exactly(:rsa, :dsa, :ecdsa, :ed25519)
|
||||
expect(described_class::SUPPORTED_KEY_TYPES).to eq(Gitlab::SSHPublicKey.supported_types)
|
||||
end
|
||||
|
||||
it 'does not allow all key types to be disabled' do
|
||||
|
|
Loading…
Reference in a new issue