mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
3.6 KiB
3.6 KiB
Added, Status, Last reviewed
Added | Status | Last reviewed |
---|---|---|
v2.0.0 | Active | 2018-03-29 |
Authentication Service
Provides authentication to ACS and APS.
Class members
Methods
- getBpmUsername():
string
Gets the BPM username- Returns
string
- The BPM username
- Returns
- getEcmUsername():
string
Gets the ECM username.- Returns
string
- The ECM username
- Returns
- getRedirect(provider:
string
=null
):any[]
Gets the URL to redirect to after login.- provider:
string
- Service provider. Can be "ECM", "BPM" or "ALL". - Returns
any[]
- The redirect URL
- provider:
- getTicketBpm():
string | null
Gets the BPM ticket stored in the Storage.- Returns
string | null
- The ticket ornull
if none was found
- Returns
- getTicketEcm():
string | null
Gets the ECM ticket stored in the Storage.- Returns
string | null
- The ticket ornull
if none was found
- Returns
- getTicketEcmBase64():
string | null
Gets the BPM ticket from the Storage in Base 64 format.- Returns
string | null
- The ticket ornull
if none was found
- Returns
- handleError(error:
any
=null
):Observable<any>
Prints an error message in the console browser- error:
any
- Error message - Returns
Observable<any>
- Object representing the error message
- error:
- isBpmLoggedIn():
boolean
Checks if the user is logged in on a BPM provider.- Returns
boolean
- True if logged in, false otherwise
- Returns
- isEcmLoggedIn():
boolean
Checks if the user is logged in on an ECM provider.- Returns
boolean
- True if logged in, false otherwise
- Returns
- isLoggedIn():
boolean
Checks if the user logged in.- Returns
boolean
- True if logged in, false otherwise
- Returns
- isRememberMeSet():
boolean
Checks whether the "remember me" cookie was set or not.- Returns
boolean
- True if set, false otherwise
- Returns
- login(username:
string
=null
, password:string
=null
, rememberMe:boolean
=false
):Observable<object>
Logs the user in.- username:
string
- Username for the login - password:
string
- Password for the login - rememberMe:
boolean
- Stores the user's login details if true - Returns
Observable<object>
- Object with auth type ("ECM", "BPM" or "ALL") and auth ticket
- username:
- logout():
Observable<any>
Logs the user out.- Returns
Observable<any>
- Response event called when logout is complete
- Returns
- removeTicket()
Removes the login ticket from Storage. - saveTicketAuth()
Saves the AUTH ticket in the Storage. - saveTicketBpm()
Saves the BPM ticket in the Storage. - saveTicketEcm()
Saves the ECM ticket in the Storage. - saveTickets()
Saves the ECM and BPM ticket in the Storage. - setRedirect(url:
RedirectionModel
=null
)
Sets the URL to redirect to after login.- url:
RedirectionModel
- URL to redirect to
- url:
Details
Usage example
import { AuthenticationService } from '@alfresco/adf-core';
@Component({...})
export class AppComponent {
constructor(authService: AuthenticationService) {
this.AuthenticationService.login('admin', 'admin').subscribe(
token => {
console.log(token);
},
error => {
console.log(error);
}
);
}
}