Initial auth module library

This commit is contained in:
Andras Popovics
2023-01-26 19:31:17 +01:00
parent 763597c6fb
commit a3ce71ac0e
24 changed files with 599 additions and 67 deletions

View File

@@ -15,6 +15,16 @@
"upload": {
"threads": 1
},
"authentication": {
"issuer": "{protocol}//{hostname}{:port}/auth/realms/alfresco",
"loginUrl": "{protocol}//{hostname}{:port}/auth/realms/alfresco/protocol/openid-connect/auth",
"silentRefreshRedirectUri": "{protocol}//{hostname}{:port}/assets/silent-refresh.html",
"redirectUri": "/",
"postLogoutRedirectUri": "#/logout",
"clientId": "alfresco",
"scope": "openid profile email",
"responseType": "code"
},
"oauth2": {
"host": "{protocol}//{hostname}{:port}/auth/realms/alfresco",
"clientId": "alfresco",

View File

@@ -29,7 +29,8 @@ import {
DebugAppConfigService,
CoreModule,
CoreAutomationService,
AuthBearerInterceptor
AuthBearerInterceptor,
AppConfigModule
} from '@alfresco/adf-core';
import { ExtensionsModule } from '@alfresco/adf-extensions';
import { AppComponent } from './app.component';
@@ -115,6 +116,7 @@ import localeSv from '@angular/common/locales/sv';
import { setupAppNotifications } from './services/app-notifications-factory';
import { AppNotificationsService } from './services/app-notifications.service';
import { SearchFilterChipsComponent } from './components/search/search-filter-chips.component';
import { AuthModule } from '@alfresco/adf-core/auth';
registerLocaleData(localeFr);
registerLocaleData(localeDe);
@@ -133,18 +135,42 @@ registerLocaleData(localeFi);
registerLocaleData(localeDa);
registerLocaleData(localeSv);
debugger;
@NgModule({
imports: [
BrowserModule,
environment.e2e ? NoopAnimationsModule : BrowserAnimationsModule,
...(environment.oidc ?
[
// Initial navigation must be disabled when we use the OIDC package with HashLocationStrategy, check its documentation
RouterModule.forRoot(appRoutes, { useHash: true, relativeLinkResolution: 'legacy', initialNavigation: 'disabled' }),
// With this, we bypass the legacy behaviour, and won't load the app config and don't initialize the JS API
CoreModule.forRoot({ authByJsApi: false }),
// So, instead, we need to load the app config. hence the forRoot() method:
AppConfigModule.forRoot(),
// and here we need to initialize the auth module
AuthModule
// And finally, we can initialize the api services to wotk with the new authentication
// TODO: new form of AlfrescoApiService, which is compatible with the new authentication
]:
// CANARY: remove this when we can use the new authentication
// ------------------------------------------------------------------
[
RouterModule.forRoot(appRoutes, { useHash: true, relativeLinkResolution: 'legacy' }),
CoreModule.forRoot({ authByJsApi: true })
]
),
ReactiveFormsModule,
RouterModule.forRoot(appRoutes, { useHash: true, relativeLinkResolution: 'legacy' }),
FormsModule,
HttpClientModule,
MaterialModule,
FlexLayoutModule,
TranslateModule.forRoot(),
CoreModule.forRoot(),
ContentModule.forRoot(),
InsightsModule.forRoot(),
ProcessModule.forRoot(),

View File

@@ -0,0 +1,27 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`.
export const environment = {
production: false,
e2e: false,
oidc: true
};

View File

@@ -17,5 +17,6 @@
export const environment = {
production: false,
e2e: true
e2e: true,
oidc: false
};

View File

@@ -17,5 +17,6 @@
export const environment = {
production: true,
e2e: false
e2e: false,
oidc: false
};

View File

@@ -22,5 +22,6 @@
export const environment = {
production: false,
e2e: false
e2e: false,
oidc: false
};