mirror of https://github.com/rancher/dashboard.git
fix(auth/oidc): reset issuer and auth endpoint if oidcUrls.url is empty (#11650)
* fix(auth/oidc): reset issuer and auth endpoint if oidcUrls.url is empty * test(auth/oidc): clear URL should clear issuer and auth-endpoint if Keycloak
This commit is contained in:
parent
4af23f6d6a
commit
bef1ffc295
|
|
@ -206,4 +206,20 @@ describe('oidc.vue', () => {
|
|||
expect(endpointValue).toBe(`${ oldUrl }/realms/${ newRealm }/protocol/openid-connect/auth`);
|
||||
});
|
||||
});
|
||||
|
||||
it('clear URL should clear issuer and auth-endpoint if Keycloak', async() => {
|
||||
wrapper.vm.model.id = 'keycloakoidc';
|
||||
const newUrl = 'whatever';
|
||||
const urlInput = wrapper.find(`[data-testid="oidc-url"]`);
|
||||
|
||||
await urlInput.setValue(newUrl);
|
||||
await wrapper.vm.$nextTick();
|
||||
await urlInput.setValue('');
|
||||
await wrapper.vm.$nextTick();
|
||||
const issuer = (wrapper.find('[data-testid="oidc-issuer"]').element as HTMLInputElement).value;
|
||||
const endpoint = (wrapper.find('[data-testid="oidc-auth-endpoint"]').element as HTMLInputElement).value;
|
||||
|
||||
expect(issuer).toBe('');
|
||||
expect(endpoint).toBe('');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -149,10 +149,16 @@ export default {
|
|||
|
||||
methods: {
|
||||
updateEndpoints() {
|
||||
const isKeycloak = this.model.id === 'keycloakoidc';
|
||||
|
||||
if (!this.oidcUrls.url) {
|
||||
this.model.issuer = '';
|
||||
if (isKeycloak) {
|
||||
this.model.authEndpoint = '';
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
const isKeycloak = this.model.id === 'keycloakoidc';
|
||||
|
||||
const url = this.oidcUrls.url.replaceAll(' ', '');
|
||||
const realmsPath = 'realms';
|
||||
|
|
|
|||
Loading…
Reference in New Issue