Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADF 7.0.0-alpha.2 - Angular 15 - Set authentication with ticket from backend #10249

Open
anakin59490 opened this issue Sep 26, 2024 · 0 comments

Comments

@anakin59490
Copy link

Hello,

Node version (for build issues):

  • Angular 15
  • Node 20.9.0
  • Npm 10.1.0
  • alfresco-content-repository-community:7.3.1
  • Docker

Browser and version:

Current behaviour:

I have an application with Angular frontend et 2 backends : 1 spring-boot backend that communicate with Alfresco backend.
For login : the front get a token from the alfresco backend.

Now , since there is ADF 7.0.0-alpha.2 version i would like to use alfresco-js-api and other adf component without to call the login ADF method, because I already have a token ex : "TICKET_6459b3c18f133ec38e87f262cc010d6a4999810f" from backend.

So I try to initialize the authentication element like that :

`setSession(token, username) {
// this.alfrescoApiService.getInstance().login('admin', 'admin');
// this.authenticationservice.login('admin', 'admin')
//.token = 'Basic ' + btoa(next[0].message);
// this.authenticationservice.login('admin', 'admin').subscribe(
// token => {
// console.log(token);
// },
// error => {
// console.log(error);
// }
// );

   this.alfrescoApiService.getInstance().authClient.basicAuth('ROLE_TICKET', token);
   this.alfrescoApiService.getInstance().storage.setItem('ticket-ECM', token);
   this.alfrescoApiService.getInstance().storage.setItem('ACS_USERNAME', username);
   this.alfrescoApiService.getInstance().setTicket(token, null);

   // OTHER TRY
   //this.authentications.basicAuth.username = 'ROLE_TICKET';
   //this.authentications.basicAuth.password = ticket;
   //this.config.ticketEcm = ticket;
   //  this.ticket = ticket;
   // this.alfrescoApiService.getInstance().setAuthenticationClientECMBPM(
   //     this.alfrescoApiService.getInstance().contentAuth.getAuthentication(),
   //     null);
   // this.alfrescoApiService.getInstance().config.ticketEcm = token;

   localStorage.setItem('accessToken', btoa(token));
  // console.log(token)
  //localStorage.setItem('accessToken', token.replaceAll('Basic ', ''));
  return this.http.get(this.apiUrl + '/api/user/me');

}`

But when I use ADF component i get 401 error, ex:

http://localhost:4200/alfresco/api/-default-/public/alfresco/versions/1/nodes/-my-?include=path%2Cproperties%2CallowableOperations%2Cpermissions%2CaspectNames

What is missing ?

Configuration adf.module :

imports: [
// ADF modules
CoreModule.forRoot(),
ContentModule.forRoot(),
AuthModule.forRoot({ useHash: true }),
TranslateModule.forRoot({
loader: { provide: TranslateLoader, useClass: TranslateLoaderService }
})
],
providers: [
AppConfigService,
{
provide: TRANSLATION_PROVIDER,
multi: true,
useValue: {
name: 'app',
source: 'assets'
}
}
]

  • Support request
  • Documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant