@alfresco/adf-core
Version:
73 lines (72 loc) • 2.28 kB
TypeScript
import { AdfHttpClient } from '@alfresco/adf-core/api';
import { AppConfigService } from '../../app-config/app-config.service';
import { StorageService } from '../../common/services/storage.service';
import { ReplaySubject, Subject } from 'rxjs';
import { Authentication } from '../interfaces/authentication.interface';
import * as i0 from "@angular/core";
export interface TicketBody {
userId?: string;
password?: string;
}
export interface TicketEntry {
entry: {
id?: string;
userId?: string;
};
}
export declare class ContentAuth {
private appConfigService;
private adfHttpClient;
private storageService;
onLogin: ReplaySubject<any>;
onLogout: ReplaySubject<any>;
onError: Subject<any>;
ticket: string;
config: {
ticketEcm: any;
};
authentications: Authentication;
get basePath(): string;
constructor(appConfigService: AppConfigService, adfHttpClient: AdfHttpClient, storageService: StorageService);
private setConfig;
saveUsername(username: string): void;
getUsername(): string;
/**
* login Alfresco API
*
* @param username username to login
* @param password password to login
* @returns A promise that returns {new authentication ticket} if resolved and {error} if rejected.
*/
login(username: string, password: string): Promise<any>;
/**
* logout Alfresco API
*
* @returns A promise that returns { authentication ticket} if resolved and {error} if rejected.
*/
logout(): Promise<any>;
/**
* Set the current Ticket
*
* @param ticket a string representing the ticket
*/
setTicket(ticket: string): void;
/**
* @returns the current Ticket
*/
getToken(): string;
invalidateSession(): void;
/**
* @returns If the client is logged in return true
*/
isLoggedIn(): boolean;
/**
* @returns return the Authentication
*/
getAuthentication(): Authentication;
createTicket(ticketBodyCreate: TicketBody): Promise<TicketEntry>;
requireAlfTicket(): Promise<void>;
deleteTicket(): Promise<any>;
static ɵfac: i0.ɵɵFactoryDeclaration<ContentAuth, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ContentAuth>;
}