mirror of https://github.com/rancher/ui.git
parent
4688f13e49
commit
376c858ab5
|
|
@ -0,0 +1,67 @@
|
||||||
|
import Component from '@ember/component';
|
||||||
|
import layout from './template';
|
||||||
|
import { get, set, observer, setProperties } from '@ember/object';
|
||||||
|
import C from 'ui/utils/constants';
|
||||||
|
|
||||||
|
export default Component.extend({
|
||||||
|
layout,
|
||||||
|
|
||||||
|
authConfig: null,
|
||||||
|
isEnabled: null,
|
||||||
|
|
||||||
|
region: null,
|
||||||
|
|
||||||
|
init() {
|
||||||
|
this._super(...arguments);
|
||||||
|
|
||||||
|
if ( get(this, 'isEnabled') ) {
|
||||||
|
const endpoint = get(this, 'authConfig.endpoint');
|
||||||
|
|
||||||
|
if ( C.AZURE_AD.STANDARD.ENDPOINT.startsWith(endpoint) ) {
|
||||||
|
set(this, 'region', C.AZURE_AD.STANDARD.KEY);
|
||||||
|
} else if ( C.AZURE_AD.CHINA.ENDPOINT.startsWith(endpoint) ) {
|
||||||
|
set(this, 'region', C.AZURE_AD.CHINA.KEY);
|
||||||
|
} else {
|
||||||
|
set(this, 'region', C.AZURE_AD.CUSTOM.KEY);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
set(this, 'region', C.AZURE_AD.STANDARD.KEY);
|
||||||
|
this.regionDidChange();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
regionDidChange: observer('region', 'authConfig.tenantId', function() {
|
||||||
|
const config = get(this, 'authConfig');
|
||||||
|
|
||||||
|
const tenantId = get(this, 'authConfig.tenantId') || '';
|
||||||
|
|
||||||
|
const region = get(this, 'region');
|
||||||
|
|
||||||
|
switch (region) {
|
||||||
|
case C.AZURE_AD.STANDARD.KEY:
|
||||||
|
setProperties(config, {
|
||||||
|
endpoint: C.AZURE_AD.STANDARD.ENDPOINT,
|
||||||
|
graphEndpoint: C.AZURE_AD.STANDARD.GRAPH_ENDPOINT,
|
||||||
|
tokenEndpoint: `${ C.AZURE_AD.STANDARD.ENDPOINT }${ tenantId }/oauth2/token`,
|
||||||
|
authEndpoint: `${ C.AZURE_AD.STANDARD.ENDPOINT }${ tenantId }/oauth2/authorize`,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case C.AZURE_AD.CHINA.KEY:
|
||||||
|
setProperties(config, {
|
||||||
|
endpoint: C.AZURE_AD.CHINA.ENDPOINT,
|
||||||
|
graphEndpoint: C.AZURE_AD.CHINA.GRAPH_ENDPOINT,
|
||||||
|
tokenEndpoint: `${ C.AZURE_AD.CHINA.ENDPOINT }${ tenantId }/oauth2/token`,
|
||||||
|
authEndpoint: `${ C.AZURE_AD.CHINA.ENDPOINT }${ tenantId }/oauth2/authorize`,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case C.AZURE_AD.CUSTOM.KEY:
|
||||||
|
setProperties(config, {
|
||||||
|
endpoint: C.AZURE_AD.STANDARD.ENDPOINT,
|
||||||
|
graphEndpoint: '',
|
||||||
|
tokenEndpoint: '',
|
||||||
|
authEndpoint: '',
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
<label class="acc-label mt-5">{{t 'authPage.azuread.configure.endpoints.label'}}{{field-required}}</label>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col span-6">
|
||||||
|
<div class="radio">
|
||||||
|
<label>
|
||||||
|
{{radio-button selection=region value='standard'}} {{t 'authPage.azuread.configure.regions.standard'}}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col span-6">
|
||||||
|
<div class="radio">
|
||||||
|
<label>
|
||||||
|
{{radio-button selection=region value='china'}} {{t 'authPage.azuread.configure.regions.china'}}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col span-6">
|
||||||
|
<div class="radio">
|
||||||
|
<label>
|
||||||
|
{{radio-button selection=region value='custom'}} {{t 'authPage.azuread.configure.regions.custom'}}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{!-- {{#if (eq region 'custom')}} --}}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col span-6">
|
||||||
|
<div class="inline-form">
|
||||||
|
<label class="acc-label pb-5" for="endpoint">{{t 'authPage.azuread.configure.azureADEndpoint.label'}}{{field-required}}</label>
|
||||||
|
{{input id="endpoint" type="url" value=authConfig.endpoint classNames="form-control"}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col span-6">
|
||||||
|
<div class="inline-form">
|
||||||
|
<label class="acc-label pb-5" for="graph-endpoint">{{t 'authPage.azuread.configure.azureADGraphEndpoint.label'}}{{field-required}}</label>
|
||||||
|
{{input id="graph-endpoint" type="url" value=authConfig.graphEndpoint classNames="form-control"}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col span-6">
|
||||||
|
<div class="inline-form">
|
||||||
|
<label class="acc-label pb-5" for="token-endpoint" >{{t 'authPage.azuread.configure.azureADTokenEndpoint.label'}}{{field-required}}</label>
|
||||||
|
{{input id="token-endpoint" type="url" value=authConfig.tokenEndpoint classNames="form-control"}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col span-6">
|
||||||
|
<div class="inline-form">
|
||||||
|
<label class="acc-label pb-5" for="auth-endpoint">{{t 'authPage.azuread.configure.azureADAuthEndpoint.label'}}{{field-required}}</label>
|
||||||
|
{{input id="auth-endpoint" type="url" value=authConfig.authEndpoint classNames="form-control"}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{!-- {{/if}} --}}
|
||||||
|
|
@ -17,6 +17,7 @@ export default Controller.extend(AuthMixin, {
|
||||||
editing: false,
|
editing: false,
|
||||||
errors: null,
|
errors: null,
|
||||||
error: null,
|
error: null,
|
||||||
|
region: null,
|
||||||
_boundSucceed: null,
|
_boundSucceed: null,
|
||||||
|
|
||||||
authConfig: alias('model.azureADConfig'),
|
authConfig: alias('model.azureADConfig'),
|
||||||
|
|
|
||||||
|
|
@ -106,34 +106,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
{{#if authConfig}}
|
||||||
<div class="col span-6">
|
{{azuread-endpoints isEnabled=isEnabled authConfig=authConfig}}
|
||||||
<div class="inline-form">
|
{{/if}}
|
||||||
<label class="acc-label pb-5" for="endpoint">{{t 'authPage.azuread.configure.azureADEndpoint.label'}}{{field-required}}</label>
|
|
||||||
{{input id="endpoint" type="url" value=authConfig.endpoint classNames="form-control"}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col span-6">
|
|
||||||
<div class="inline-form">
|
|
||||||
<label class="acc-label pb-5" for="graph-endpoint">{{t 'authPage.azuread.configure.azureADGraphEndpoint.label'}}{{field-required}}</label>
|
|
||||||
{{input id="graph-endpoint" type="url" value=authConfig.graphEndpoint classNames="form-control"}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col span-6">
|
|
||||||
<div class="inline-form">
|
|
||||||
<label class="acc-label pb-5" for="token-endpoint" >{{t 'authPage.azuread.configure.azureADTokenEndpoint.label'}}{{field-required}}</label>
|
|
||||||
{{input id="token-endpoint" type="url" value=authConfig.tokenEndpoint classNames="form-control"}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col span-6">
|
|
||||||
<div class="inline-form">
|
|
||||||
<label class="acc-label pb-5" for="auth-endpoint">{{t 'authPage.azuread.configure.azureADAuthEndpoint.label'}}{{field-required}}</label>
|
|
||||||
{{input id="auth-endpoint" type="url" value=authConfig.authEndpoint classNames="form-control"}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row mt-10">
|
<div class="row mt-10">
|
||||||
<div class="inline-form">
|
<div class="inline-form">
|
||||||
<button class="btn bg-primary" style="display: block;margin: 0 auto;" {{action "test"}}>
|
<button class="btn bg-primary" style="display: block;margin: 0 auto;" {{action "test"}}>
|
||||||
|
|
|
||||||
|
|
@ -604,6 +604,20 @@ C.SUPPORTED_SCHEMA_INPUTS = [
|
||||||
'base64',
|
'base64',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
C.AZURE_AD = {
|
||||||
|
STANDARD: {
|
||||||
|
KEY: 'standard',
|
||||||
|
ENDPOINT: 'https://login.microsoftonline.com/',
|
||||||
|
GRAPH_ENDPOINT: 'https://graph.windows.net/'
|
||||||
|
},
|
||||||
|
CHINA: {
|
||||||
|
KEY: 'china',
|
||||||
|
ENDPOINT: 'https://login.chinacloudapi.cn/',
|
||||||
|
GRAPH_ENDPOINT: 'https://graph.chinacloudapi.cn/'
|
||||||
|
},
|
||||||
|
CUSTOM: { KEY: 'custom' }
|
||||||
|
};
|
||||||
|
|
||||||
C.AZURE_DEFAULTS = [
|
C.AZURE_DEFAULTS = [
|
||||||
'aadClientCertPassword',
|
'aadClientCertPassword',
|
||||||
'aadClientCertPath',
|
'aadClientCertPath',
|
||||||
|
|
|
||||||
|
|
@ -511,6 +511,12 @@ authPage:
|
||||||
label: Token Endpoint
|
label: Token Endpoint
|
||||||
azureADAuthEndpoint:
|
azureADAuthEndpoint:
|
||||||
label: Auth Endpoint
|
label: Auth Endpoint
|
||||||
|
endpoints:
|
||||||
|
label: Endpoints
|
||||||
|
regions:
|
||||||
|
standard: Standard
|
||||||
|
china: China
|
||||||
|
custom: Custom
|
||||||
tenantId:
|
tenantId:
|
||||||
label: Tenant ID
|
label: Tenant ID
|
||||||
placeholder: A long UUID string
|
placeholder: A long UUID string
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue