1 parent
d130a019d7
commit
e36ee56de1
12 files changed
+103
-40
No files matched your search
@@ -61,7 +61,7 @@ export default class GeneratedAuthMethodModel extends BaseModel {
|
||||
|
||||
@attr('string', { isNestedAttribute: true }) client_id;
|
||||
|
||||
@attr('string', { isNestedAttribute: true }) client_secret;
|
||||
@attr('string', { isNestedAttribute: true, isSecret: true }) client_secret;
|
||||
|
||||
@attr('string', { readOnly: true, isNestedAttribute: true })
|
||||
client_secret_hmac;
|
||||
|
||||
@@ -84,6 +84,19 @@ export default class GeneratedTargetModel extends BaseModel {
|
||||
})
|
||||
address;
|
||||
|
||||
@attr('number', {
|
||||
isNestedAttribute: true,
|
||||
description: 'The default port a target should use if present.',
|
||||
})
|
||||
default_port;
|
||||
|
||||
@attr('number', {
|
||||
isNestedAttribute: true,
|
||||
description:
|
||||
"The default port that will be listened on by the client's local proxy.",
|
||||
})
|
||||
default_client_port;
|
||||
|
||||
@attr('string', {
|
||||
description: 'The storage bucket associated with this target.',
|
||||
isNestedAttribute: true,
|
||||
|
||||
@@ -18,12 +18,6 @@ export default class TargetModel extends GeneratedTargetModel {
|
||||
|
||||
// =attributes
|
||||
|
||||
@attr('number', {
|
||||
isNestedAttribute: true,
|
||||
description: 'The default port a target should use if present.',
|
||||
})
|
||||
default_port;
|
||||
|
||||
/**
|
||||
* @type Array
|
||||
*/
|
||||
|
||||
@@ -17,5 +17,6 @@ export default Factory.extend({
|
||||
updated_time: () => faker.date.recent(),
|
||||
disabled: () => faker.datatype.boolean(),
|
||||
default_port: () => faker.datatype.number(),
|
||||
default_client_port: () => faker.datatype.number(),
|
||||
version: () => faker.datatype.number(),
|
||||
});
|
||||
@@ -89,6 +89,55 @@ module('Unit | Serializer | auth method', function (hooks) {
|
||||
});
|
||||
});
|
||||
|
||||
test("it doesn't serialize client secrets when not set", function (assert) {
|
||||
assert.expect(1);
|
||||
let store = this.owner.lookup('service:store');
|
||||
let record = store.createRecord('auth-method', {
|
||||
type: TYPE_AUTH_METHOD_OIDC,
|
||||
name: 'OIDC Auth Method',
|
||||
state: 'foo',
|
||||
account_claim_maps: [{ from: 'foo', to: 'bar' }],
|
||||
claims_scopes: [{ value: 'profile' }, { value: 'email' }],
|
||||
signing_algorithms: [{ value: 'RS256' }, { value: 'RS384' }],
|
||||
allowed_audiences: [
|
||||
{ value: 'www.alice.com' },
|
||||
{ value: 'www.alice.com/admin' },
|
||||
],
|
||||
idp_ca_certs: [
|
||||
{ value: 'certificate-1234' },
|
||||
{ value: 'certificate-5678' },
|
||||
],
|
||||
api_url_prefix: 'protocol://host:port/foo',
|
||||
client_id: 'id123',
|
||||
client_secret: null,
|
||||
disable_discovered_config_validation: true,
|
||||
dry_run: true,
|
||||
issuer: 'http://www.example.net',
|
||||
max_age: 500,
|
||||
});
|
||||
|
||||
let serializedRecord = record.serialize();
|
||||
|
||||
assert.deepEqual(serializedRecord, {
|
||||
type: TYPE_AUTH_METHOD_OIDC,
|
||||
name: 'OIDC Auth Method',
|
||||
description: null,
|
||||
attributes: {
|
||||
account_claim_maps: ['foo=bar'],
|
||||
claims_scopes: ['profile', 'email'],
|
||||
signing_algorithms: ['RS256', 'RS384'],
|
||||
allowed_audiences: ['www.alice.com', 'www.alice.com/admin'],
|
||||
idp_ca_certs: ['certificate-1234', 'certificate-5678'],
|
||||
api_url_prefix: 'protocol://host:port/foo',
|
||||
client_id: 'id123',
|
||||
disable_discovered_config_validation: true,
|
||||
dry_run: true,
|
||||
issuer: 'http://www.example.net',
|
||||
max_age: 500,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test('it serializes OIDC records with only state and version when `adapterOptions.state` is passed', function (assert) {
|
||||
assert.expect(1);
|
||||
const store = this.owner.lookup('service:store');
|
||||
|
||||
@@ -31,6 +31,7 @@ module('Unit | Serializer | target', function (hooks) {
|
||||
type: 'org',
|
||||
},
|
||||
default_port: 1234,
|
||||
default_client_port: 4321,
|
||||
version: 1,
|
||||
type: TYPE_TARGET_TCP,
|
||||
address: '0.0.0.0',
|
||||
@@ -51,6 +52,7 @@ module('Unit | Serializer | target', function (hooks) {
|
||||
ingress_worker_filter: null,
|
||||
attributes: {
|
||||
default_port: 1234,
|
||||
default_client_port: 4321,
|
||||
enable_session_recording: false,
|
||||
storage_bucket_id: null,
|
||||
},
|
||||
@@ -160,6 +162,7 @@ module('Unit | Serializer | target', function (hooks) {
|
||||
ingress_worker_filter: null,
|
||||
attributes: {
|
||||
default_port: 1234,
|
||||
default_client_port: null,
|
||||
enable_session_recording: true,
|
||||
storage_bucket_id: 'bucketID',
|
||||
},
|
||||
@@ -197,6 +200,7 @@ module('Unit | Serializer | target', function (hooks) {
|
||||
ingress_worker_filter: null,
|
||||
attributes: {
|
||||
default_port: 1234,
|
||||
default_client_port: null,
|
||||
enable_session_recording: false,
|
||||
storage_bucket_id: null,
|
||||
},
|
||||
@@ -234,6 +238,7 @@ module('Unit | Serializer | target', function (hooks) {
|
||||
ingress_worker_filter: null,
|
||||
attributes: {
|
||||
default_port: 1234,
|
||||
default_client_port: null,
|
||||
enable_session_recording: false,
|
||||
storage_bucket_id: null,
|
||||
},
|
||||
@@ -271,6 +276,7 @@ module('Unit | Serializer | target', function (hooks) {
|
||||
ingress_worker_filter: 'ingress worker',
|
||||
attributes: {
|
||||
default_port: 1234,
|
||||
default_client_port: null,
|
||||
enable_session_recording: false,
|
||||
storage_bucket_id: null,
|
||||
},
|
||||
|
||||
@@ -33,9 +33,6 @@ grant:
|
||||
address:
|
||||
label: Address
|
||||
help: An IP, host name, or other routable address
|
||||
default_port:
|
||||
label: Default Port
|
||||
help: The default port on which to connect
|
||||
current_password:
|
||||
label: Current Password
|
||||
new_password:
|
||||
|
||||
@@ -434,6 +434,12 @@ target:
|
||||
worker_filter:
|
||||
label: Worker Filter
|
||||
help: Deprecated. Boolean expression to filter the workers that are allowed to satisfy this request.
|
||||
default_port:
|
||||
label: Default Port
|
||||
help: The default port on which to connect.
|
||||
default_client_port:
|
||||
label: Default Client Port
|
||||
help: The local proxy port on which to listen by default when a session is started on a client.
|
||||
sidebar:
|
||||
label: Session Recording
|
||||
help: Record SSH sessions on this target and save them to an Amazon S3 bucket.
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
</G.RadioCard>
|
||||
{{/each}}
|
||||
</Hds::Form::RadioCard::Group>
|
||||
<Hds::Form::RadioCard::Group @name='type' @alignment='center' as |G|>
|
||||
<Hds::Form::RadioCard::Group @name='plugin_type' @alignment='center' as |G|>
|
||||
<G.Legend>{{t 'titles.provider'}}</G.Legend>
|
||||
<G.Legend>{{t 'titles.choose-a-provider'}}</G.Legend>
|
||||
<G.HelperText>{{t 'descriptions.choose-a-provider'}}</G.HelperText>
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
</G.RadioCard>
|
||||
{{/each}}
|
||||
</Hds::Form::RadioCard::Group>
|
||||
<Hds::Form::RadioCard::Group @name='type' @alignment='center' as |G|>
|
||||
<Hds::Form::RadioCard::Group @name='plugin_type' @alignment='center' as |G|>
|
||||
<G.Legend>{{t 'titles.provider'}}</G.Legend>
|
||||
<G.Legend>{{t 'titles.choose-a-provider'}}</G.Legend>
|
||||
<G.HelperText>{{concat
|
||||
|
||||
@@ -71,32 +71,6 @@
|
||||
</G.RadioCard>
|
||||
{{/each}}
|
||||
</Hds::Form::RadioCard::Group>
|
||||
|
||||
{{#if @model.isPlugin}}
|
||||
|
||||
<Hds::Form::RadioCard::Group @name='type' as |G|>
|
||||
<G.Legend>{{t 'titles.provider'}}</G.Legend>
|
||||
<G.Legend>{{t 'titles.choose-a-provider'}}</G.Legend>
|
||||
<G.HelperText>{{t 'descriptions.choose-a-provider'}}</G.HelperText>
|
||||
|
||||
{{#each-in this.mapResourceTypeWithIcon as |pluginType|}}
|
||||
<G.RadioCard
|
||||
@value={{pluginType}}
|
||||
@checked={{eq pluginType @model.type}}
|
||||
@maxWidth='20rem'
|
||||
{{on 'input' (fn @changeType pluginType)}}
|
||||
as |R|
|
||||
>
|
||||
<R.Label>{{t
|
||||
(concat 'resources.host-catalog.types.' pluginType)
|
||||
}}</R.Label>
|
||||
<R.Description>{{t
|
||||
(concat 'resources.host-catalog.help.' pluginType)
|
||||
}}</R.Description>
|
||||
</G.RadioCard>
|
||||
{{/each-in}}
|
||||
</Hds::Form::RadioCard::Group>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{#if (can 'save model' @model)}}
|
||||
|
||||
@@ -123,9 +123,9 @@
|
||||
as |F|
|
||||
>
|
||||
<F.Label data-test-default-port-label>{{t
|
||||
'form.default_port.label'
|
||||
'resources.target.form.default_port.label'
|
||||
}}</F.Label>
|
||||
<F.HelperText>{{t 'form.default_port.help'}}</F.HelperText>
|
||||
<F.HelperText>{{t 'resources.target.form.default_port.help'}}</F.HelperText>
|
||||
{{#if @model.errors.default_port}}
|
||||
<F.Error as |E|>
|
||||
{{#each @model.errors.default_port as |error|}}
|
||||
@@ -135,6 +135,29 @@
|
||||
{{/if}}
|
||||
</Hds::Form::TextInput::Field>
|
||||
|
||||
<Hds::Form::TextInput::Field
|
||||
@isOptional={{true}}
|
||||
@value={{@model.default_client_port}}
|
||||
@isInvalid={{@model.errors.default_client_port}}
|
||||
@type='text'
|
||||
name='default_client_port'
|
||||
disabled={{form.disabled}}
|
||||
{{on 'input' (set-from-event @model 'default_client_port')}}
|
||||
as |F|
|
||||
>
|
||||
<F.Label>{{t 'resources.target.form.default_client_port.label'}}</F.Label>
|
||||
<F.HelperText>{{t
|
||||
'resources.target.form.default_client_port.help'
|
||||
}}</F.HelperText>
|
||||
{{#if @model.errors.default_client_port}}
|
||||
<F.Error as |E|>
|
||||
{{#each @model.errors.default_client_port as |error|}}
|
||||
<E.Message>{{error.message}}</E.Message>
|
||||
{{/each}}
|
||||
</F.Error>
|
||||
{{/if}}
|
||||
</Hds::Form::TextInput::Field>
|
||||
|
||||
<Hds::Form::TextInput::Field
|
||||
@isOptional={{true}}
|
||||
@value={{@model.session_max_seconds}}
|
||||
|
||||
Reference in new issue
Block a user