Search code examples
angularalfresco

How to "auto-login" user in Alfresco-ADF angular 6


I'm setting up a web application, where user click on some link will take them ADF angular 6 project which allows user to use Alfresco as shared drive . Everything is working fine except that, user has to specifically login into Alfresco ADF. As i have the credentials and do trust on all users having all permissions, can additional login page of alfresco be removed ?

I tried to customize class LoginComponent, so that i can submit form by js.

import { Component, AfterViewInit } from '@angular/core';

@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css']
})
export class LoginComponent implements AfterViewInit {
  ngAfterViewInit() {
  (<HTMLInputElement>document.getElementById('username')).value = 'admin';
  (<HTMLInputElement>document.getElementById('password')).value = 'xxxx';
  (<HTMLFormElement>document.getElementById('adf-login-form')).submit;
 }

}

As stated before I trust all users of my application to use alfresco as shared drive. Thus no login page is required.


Solution

  • Did some R&D and found that ADF alfresco requires "ticket-ECM" in local storage of browser for login. Fetched ticket_ID from alfresco authentication rest api and passed it to frontend to store it in local session. On doing so, user no more sees login page and works as charm !!