mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-17909][AAE-17964] fix silent-refresh url is not set with the value - fix background image set to undefined (#9080)
* [AAE-17909] fix silent-refresh url is not set with the value from the app.config.json * [AAE-17964] fix backgroundImage is undefined, set a default value
This commit is contained in:
@@ -52,7 +52,7 @@ describe('AuthConfigService', () => {
|
|||||||
secret: '',
|
secret: '',
|
||||||
implicitFlow: true,
|
implicitFlow: true,
|
||||||
silentLogin: true,
|
silentLogin: true,
|
||||||
redirectSilentIframeUri: 'http://localhost:3000/assets/silent-refresh.html',
|
redirectSilentIframeUri: 'http://localhost:3000/subfolder/assets/silent-refresh.html',
|
||||||
redirectUri: '/subfolder',
|
redirectUri: '/subfolder',
|
||||||
redirectUriLogout: '#/logout',
|
redirectUriLogout: '#/logout',
|
||||||
publicUrls: [
|
publicUrls: [
|
||||||
@@ -69,7 +69,7 @@ describe('AuthConfigService', () => {
|
|||||||
secret: '',
|
secret: '',
|
||||||
implicitFlow: true,
|
implicitFlow: true,
|
||||||
silentLogin: true,
|
silentLogin: true,
|
||||||
redirectSilentIframeUri: 'http://localhost:3000/assets/silent-refresh.html',
|
redirectSilentIframeUri: 'http://localhost:3000/subfolder2/assets/silent-refresh.html',
|
||||||
redirectUri: '/subfolder2',
|
redirectUri: '/subfolder2',
|
||||||
redirectUriLogout: '#/logout',
|
redirectUriLogout: '#/logout',
|
||||||
publicUrls: [
|
publicUrls: [
|
||||||
@@ -135,7 +135,7 @@ describe('AuthConfigService', () => {
|
|||||||
oidc: true,
|
oidc: true,
|
||||||
issuer: 'http://localhost:3000/auth/realms/alfresco',
|
issuer: 'http://localhost:3000/auth/realms/alfresco',
|
||||||
redirectUri: 'http://localhost:3000/#/view/authentication-confirmation/?',
|
redirectUri: 'http://localhost:3000/#/view/authentication-confirmation/?',
|
||||||
silentRefreshRedirectUri: 'http://localhost:3000/silent-refresh.html',
|
silentRefreshRedirectUri: 'http://localhost:3000/assets/silent-refresh.html',
|
||||||
postLogoutRedirectUri: 'http://localhost:3000/#/logout',
|
postLogoutRedirectUri: 'http://localhost:3000/#/logout',
|
||||||
clientId: 'fakeClientId',
|
clientId: 'fakeClientId',
|
||||||
scope: 'openid profile email',
|
scope: 'openid profile email',
|
||||||
@@ -151,7 +151,7 @@ describe('AuthConfigService', () => {
|
|||||||
oidc: true,
|
oidc: true,
|
||||||
issuer: 'http://localhost:3000/auth/realms/alfresco',
|
issuer: 'http://localhost:3000/auth/realms/alfresco',
|
||||||
redirectUri: 'http://localhost:3000/#/view/authentication-confirmation',
|
redirectUri: 'http://localhost:3000/#/view/authentication-confirmation',
|
||||||
silentRefreshRedirectUri: 'http://localhost:3000/silent-refresh.html',
|
silentRefreshRedirectUri: 'http://localhost:3000/assets/silent-refresh.html',
|
||||||
postLogoutRedirectUri: 'http://localhost:3000/#/logout',
|
postLogoutRedirectUri: 'http://localhost:3000/#/logout',
|
||||||
clientId: 'fakeClientId',
|
clientId: 'fakeClientId',
|
||||||
scope: 'openid profile email',
|
scope: 'openid profile email',
|
||||||
@@ -182,4 +182,18 @@ describe('AuthConfigService', () => {
|
|||||||
expect(service.getRedirectUri()).toBe(expectedUri);
|
expect(service.getRedirectUri()).toBe(expectedUri);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('silentRefreshRedirectUri', () => {
|
||||||
|
it('should return the silentRefreshRedirectUri with subfolder path', () => {
|
||||||
|
const expectedUri = 'http://localhost:3000/subfolder/assets/silent-refresh.html';
|
||||||
|
spyOnProperty(appConfigService, 'oauth2').and.returnValue(mockAuthConfigSubfolderRedirectUri);
|
||||||
|
expect(service.loadAppConfig().silentRefreshRedirectUri).toBe(expectedUri);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the silentRefreshRedirectUri with subfolder2 path', () => {
|
||||||
|
const expectedUri = 'http://localhost:3000/subfolder2/assets/silent-refresh.html';
|
||||||
|
spyOnProperty(appConfigService, 'oauth2').and.returnValue(mockAuthConfigSubfolder2RedirectUri);
|
||||||
|
expect(service.loadAppConfig().silentRefreshRedirectUri).toBe(expectedUri);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -58,7 +58,7 @@ export class AuthConfigService {
|
|||||||
oidc: oauth2.implicitFlow || oauth2.codeFlow || false,
|
oidc: oauth2.implicitFlow || oauth2.codeFlow || false,
|
||||||
issuer: oauth2.host,
|
issuer: oauth2.host,
|
||||||
redirectUri,
|
redirectUri,
|
||||||
silentRefreshRedirectUri: `${origin}/silent-refresh.html`,
|
silentRefreshRedirectUri: oauth2.redirectSilentIframeUri,
|
||||||
postLogoutRedirectUri: `${origin}/${oauth2.redirectUriLogout}`,
|
postLogoutRedirectUri: `${origin}/${oauth2.redirectUriLogout}`,
|
||||||
clientId: oauth2.clientId,
|
clientId: oauth2.clientId,
|
||||||
scope: oauth2.scope,
|
scope: oauth2.scope,
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<mat-toolbar
|
<mat-toolbar
|
||||||
[color]="color"
|
[color]="color"
|
||||||
[style.background-color]="color"
|
[style.background-color]="color"
|
||||||
[style.background-image]="'url(' + backgroundImage + ')'">
|
[style.background-image]="backgroundImage ? 'url(' + backgroundImage + ')' : 'none'">
|
||||||
<button
|
<button
|
||||||
*ngIf="showSidenavToggle && position === 'start'"
|
*ngIf="showSidenavToggle && position === 'start'"
|
||||||
id="adf-sidebar-toggle-start"
|
id="adf-sidebar-toggle-start"
|
||||||
|
@@ -81,6 +81,24 @@ describe('HeaderLayoutComponent', () => {
|
|||||||
expect(await toolbar.getCssValue('background-color')).toBe('rgb(66, 245, 126)');
|
expect(await toolbar.getCssValue('background-color')).toBe('rgb(66, 245, 126)');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should background image be set to none if is not provided', async () => {
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
const toolbarHarness = await loader.getHarness(MatToolbarHarness);
|
||||||
|
const toolbar = await toolbarHarness.host();
|
||||||
|
expect(await toolbar.getCssValue('background-image')).toEqual('none');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should background image be set to none if is provided as empty string', async () => {
|
||||||
|
component.backgroundImage = '';
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
const toolbarHarness = await loader.getHarness(MatToolbarHarness);
|
||||||
|
const toolbar = await toolbarHarness.host();
|
||||||
|
expect(await toolbar.getCssValue('background-image')).toEqual('none');
|
||||||
|
});
|
||||||
|
|
||||||
it('should change background image when provided', async () => {
|
it('should change background image when provided', async () => {
|
||||||
component.backgroundImage = '/assets/someImage.png';
|
component.backgroundImage = '/assets/someImage.png';
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
@@ -49,7 +49,7 @@ export class HeaderLayoutComponent implements OnInit {
|
|||||||
@Input() color: ThemePalette | string;
|
@Input() color: ThemePalette | string;
|
||||||
|
|
||||||
/** Path to a background image for the header. */
|
/** Path to a background image for the header. */
|
||||||
@Input() backgroundImage: string;
|
@Input() backgroundImage = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggles whether the sidenav button will be displayed in the header
|
* Toggles whether the sidenav button will be displayed in the header
|
||||||
|
Reference in New Issue
Block a user