|
188 | 188 | <div>
|
189 | 189 | <paper-input id="namespacefield" value="{{namespace}}" label="Namespace" disabled="{{loading}}"></paper-input>
|
190 | 190 | </div>
|
| 191 | +<template is="dom-if" if="{{_setMountPath(page, 0)}}"> |
| 192 | +<div> |
| 193 | +<paper-input value="{{ldapMountPath}}" label="Mount Path" disabled="{{loading}}"></paper-input> |
| 194 | +</div> |
| 195 | +</template> |
| 196 | +<template is="dom-if" if="{{_setMountPath(page, 1)}}"> |
| 197 | +<div> |
| 198 | +<paper-input value="{{tokenMountPath}}" label="Mount Path" disabled="{{loading}}"></paper-input> |
| 199 | +</div> |
| 200 | +</template> |
| 201 | +<template is="dom-if" if="{{_setMountPath(page, 2)}}"> |
| 202 | +<div> |
| 203 | +<paper-input value="{{userpassMountPath}}" label="Mount Path" disabled="{{loading}}"></paper-input> |
| 204 | +</div> |
| 205 | +</template> |
| 206 | +<template is="dom-if" if="{{_setMountPath(page, 3)}}"> |
| 207 | +<div> |
| 208 | +<paper-input value="{{oidcMountPath}}" label="Mount Path" disabled="{{loading}}"></paper-input> |
| 209 | +</div> |
| 210 | +</template> |
191 | 211 | <template is="dom-if" if="{{roleVisible}}">
|
192 | 212 | <iron-a11y-keys target="[[targetrole]]" keys="enter" on-keys-pressed="_login"></iron-a11y-keys>
|
193 | 213 | <paper-input id="rolefield" value="{{role}}" label="Role" disabled="{{loading}}"></paper-input>
|
|
205 | 225 | <app-localstorage-document key="username" data="{{username}}"></app-localstorage-document>
|
206 | 226 | <app-localstorage-document key="namespace" data="{{namespace}}"></app-localstorage-document>
|
207 | 227 | <app-localstorage-document key="optionalOpen" data="{{optionalOpen}}"></app-localstorage-document>
|
| 228 | +<app-localstorage-document key="ldapMountPath" data="{{ldapMountPath}}"></app-localstorage-document> |
| 229 | +<app-localstorage-document key="oidcMountPath" data="{{oidcMountPath}}"></app-localstorage-document> |
| 230 | +<app-localstorage-document key="tokenMountPath" data="{{tokenMountPath}}"></app-localstorage-document> |
| 231 | +<app-localstorage-document key="userpassMountPath" data="{{userpassMountPath}}"></app-localstorage-document> |
208 | 232 |
|
209 | 233 | <paper-toast id="errortoast" class="fit-bottom error" duration="5000">
|
210 | 234 | <iron-icon prefix icon="error-outline" style="padding-right: 7px;"></iron-icon>
|
|
349 | 373 | oidcStarted: {
|
350 | 374 | type: Boolean,
|
351 | 375 | value: false
|
| 376 | +}, |
| 377 | +ldapMountPath: { |
| 378 | +type: String, |
| 379 | +value: 'ldap' |
| 380 | +}, |
| 381 | +oidcMountPath: { |
| 382 | +type: String, |
| 383 | +value: 'oidc' |
| 384 | +}, |
| 385 | +tokenMountPath: { |
| 386 | +type: String, |
| 387 | +value: 'token' |
| 388 | +}, |
| 389 | +userpassMountPath: { |
| 390 | +type: String, |
| 391 | +value: 'userpass' |
352 | 392 | }
|
353 | 393 | },
|
354 | 394 | attached: function() {
|
|
403 | 443 | }
|
404 | 444 | this.authMethod = 'POST';
|
405 | 445 | this.header = {"X-Cryptr-Version": app.cryptrVersion, "X-Vault-Namespace": this.namespace};
|
406 |
| -this.authURL = this.url + 'v1/auth/ldap/login/' + this.username; |
| 446 | +this.authURL = this.url + 'v1/auth/' + this.ldapMountPath + '/login/' + this.username; |
407 | 447 | this.body = {"password": this.password };
|
408 | 448 | } else if (this.page == 1) {
|
409 | 449 | if (!this.token) { //Check field has content
|
|
413 | 453 | return;
|
414 | 454 | }
|
415 | 455 | this.authMethod = 'GET';
|
416 |
| -this.authURL = this.url + 'v1/auth/token/lookup-self'; |
| 456 | +this.authURL = this.url + 'v1/auth/' + this.tokenMountPath + '/lookup-self'; |
417 | 457 | this.header = {"X-Vault-Token": this.token, "X-Cryptr-Version": app.cryptrVersion, "X-Vault-Namespace": this.namespace };
|
418 | 458 | this.body = '';
|
419 | 459 | } else if (this.page == 2) {
|
|
424 | 464 | return;
|
425 | 465 | }
|
426 | 466 | this.authMethod = 'POST';
|
427 |
| -this.authURL = this.url + 'v1/auth/userpass/login/' + this.username; |
| 467 | +this.authURL = this.url + 'v1/auth/' + this.userpassMountPath + '/login/' + this.username; |
428 | 468 | this.header = {"X-Cryptr-Version": app.cryptrVersion, "X-Vault-Namespace": this.namespace};
|
429 | 469 | this.body = {"password": this.password };
|
430 | 470 | } else if (this.page == 3) {
|
431 | 471 | if (this.oidcStarted) {
|
432 |
| -this.oidcURL = this.url + 'v1/auth/oidc/oidc/auth_url'; |
| 472 | +this.oidcURL = this.url + 'v1/auth/' + this.oidcMountPath + '/oidc/auth_url'; |
433 | 473 | this.oidcBody = {"redirect_uri": "http://localhost:8250/oidc/callback", "role": this.role}
|
434 | 474 | this.header = {"X-Cryptr-Version": app.cryptrVersion, "X-Vault-Namespace": this.namespace};
|
435 | 475 | this.loading = true;
|
|
585 | 625 | },
|
586 | 626 | _oidcAuth: function(data) {
|
587 | 627 | this.authMethod = 'GET';
|
588 |
| -this.authURL = this.url + 'v1/auth/oidc/oidc/callback?code=' + data.code + '&state=' + data.state; |
| 628 | +this.authURL = this.url + 'v1/auth/' + this.oidcMountPath + '/oidc/callback?code=' + data.code + '&state=' + data.state; |
589 | 629 | this.body = '';
|
590 | 630 | this.header = {"X-Cryptr-Version": app.cryptrVersion, "X-Vault-Namespace": this.namespace};
|
591 | 631 | this.push('authRequests', this.$.testReq.generateRequest());
|
|
622 | 662 | },
|
623 | 663 | _watchNamespace: function() {
|
624 | 664 | this.namespaceLabel = (this.namespace) ? this.namespace : 'None'
|
| 665 | +}, |
| 666 | +_setMountPath: function(unused, id) { |
| 667 | +// 'unused' variable is passed here to trigger updating this function on page changes |
| 668 | +return id == this.page; |
625 | 669 | }
|
626 | 670 | });
|
627 | 671 | })();
|
|
0 commit comments