C:/GoDev/src/TCSTK-Angular/projects/tibco-tcstk/tc-liveapps-lib/src/lib/components/live-apps-login/live-apps-login.component.ts
Component perform a Login in case there is no valid Session yet.
If the user is not logged in the login component will be displayed automatically.
selector | tcla-live-apps-login |
styleUrls | ./live-apps-login.component.css |
templateUrl | ./live-apps-login.component.html |
Properties |
|
Methods |
Inputs |
Outputs |
HostListeners |
Accessors |
constructor(tcAppDefinitionService: TcAppDefinitionService, configService: TcCoreConfigService, credentialsService: CredentialsService)
|
||||||||||||
Parameters :
|
appName | |
Type : string
|
|
loginPrefill | |
Type : LoginPrefill
|
|
loginContext | |
Type : EventEmitter<LoginContext>
|
|
signUp | |
Type : EventEmitter
|
|
Output signUp event |
useOauth | |
Type : EventEmitter
|
|
Output useOauth event |
window:resize |
Arguments : '$event'
|
window:resize(event)
|
Inherited from
LiveAppsComponent
|
Defined in
LiveAppsComponent:45
|
handleSignUp |
handleSignUp()
|
Returns :
void
|
handleUseOauth |
handleUseOauth()
|
Returns :
void
|
ngAfterViewInit |
ngAfterViewInit()
|
Inherited from
LiveAppsComponent
|
Defined in
LiveAppsComponent:91
|
Returns :
void
|
ngOnDestroy |
ngOnDestroy()
|
Inherited from
LiveAppsComponent
|
Defined in
LiveAppsComponent:99
|
Returns :
void
|
ngOnInit |
ngOnInit()
|
Inherited from
LiveAppsComponent
|
Defined in
LiveAppsComponent:104
|
Returns :
void
|
setupWidthObserver |
setupWidthObserver()
|
Inherited from
LiveAppsComponent
|
Defined in
LiveAppsComponent:70
|
Returns :
void
|
Public appName |
Type : string
|
Default value : 'Cloud Starters'
|
handleLoggedIn |
Default value : () => {...}
|
Protected _destroyed$ |
Default value : new Subject()
|
Inherited from
LiveAppsComponent
|
Defined in
LiveAppsComponent:39
|
componentChildDivs |
Type : LiveAppsComponent[]
|
Decorators :
@ViewChildren('componentChildDiv')
|
Inherited from
LiveAppsComponent
|
Defined in
LiveAppsComponent:36
|
componentDiv |
Type : ElementRef
|
Decorators :
@ViewChild('componentDiv', {static: false})
|
Inherited from
LiveAppsComponent
|
Defined in
LiveAppsComponent:35
|
Protected containerChanges$ |
Type : Observable<TcComponent>
|
Inherited from
LiveAppsComponent
|
Defined in
LiveAppsComponent:40
|
Private observer |
Inherited from
LiveAppsComponent
|
Defined in
LiveAppsComponent:42
|
Public resize |
Default value : () => {...}
|
Inherited from
LiveAppsComponent
|
Defined in
LiveAppsComponent:56
|
Public widget |
Type : TcComponent
|
Inherited from
LiveAppsComponent
|
Defined in
LiveAppsComponent:41
|
AppName | ||||||
setAppName(appName: string)
|
||||||
Parameters :
Returns :
void
|
import {Component, EventEmitter, Input, Output} from '@angular/core';
import {LoginContext} from '../../models/liveappsdata';
import {LoginPrefill, TcCoreConfigService} from '@tibco-tcstk/tc-core-lib';
import {LiveAppsService} from '../../services/live-apps.service';
import { LiveAppsComponent } from '../live-apps-component/live-apps-component.component';
import {TcAppDefinitionService} from '../../services/tc-app-definition.service';
import {take} from 'rxjs/operators';
import {CredentialsService} from '../../services/credentials.service';
/**
* Component perform a Login in case there is no valid Session yet.
*
* If the user is not logged in the login component will be displayed automatically.
*
* ![alt-text](../Login.png "Image")
*/
@Component({
selector: 'tcla-live-apps-login',
templateUrl: './live-apps-login.component.html',
styleUrls: ['./live-apps-login.component.css']
})
export class LiveAppsLoginComponent extends LiveAppsComponent {
@Output() loginContext: EventEmitter<LoginContext> = new EventEmitter<LoginContext>();
@Input() loginPrefill: LoginPrefill;
/**
* Output useOauth event
*/
@Output() useOauth = new EventEmitter();
/**
* Output signUp event
*/
@Output() signUp = new EventEmitter();
public appName = 'Cloud Starters';
@Input('appName') set AppName(appName: string) {
if (appName) {
this.appName = appName;
}
}
constructor(protected tcAppDefinitionService: TcAppDefinitionService, protected configService: TcCoreConfigService, protected credentialsService: CredentialsService) {
super();
}
handleUseOauth() {
this.useOauth.emit();
}
handleSignUp() {
this.signUp.emit();
}
// run when logged in
handleLoggedIn = (loginInfo) => {
// remove any stored oauth token/cookie
this.credentialsService.setKey(undefined);
// update claims first
this.tcAppDefinitionService.refresh().pipe(
take(1)
).subscribe(
next => {
sessionStorage.setItem('loggedIn', Date.now().toString());
// emit useful details about the login and session/claims
// clear any oauth keys stored
/*if (this.configService && this.configService.getConfig() && this.configService.getConfig().oAuthLocalStorageKey
&& this.configService.getConfig().oAuthLocalStorageKey !== '') {
localStorage.removeItem(this.configService.getConfig().oAuthLocalStorageKey);
}*/
this.credentialsService.setMode('cookies');
this.loginContext.emit(new LoginContext().deserialize(
{
authInfo: loginInfo.authInfo,
accessToken: loginInfo.accessToken
}));
});
}
}
<tc-tibco-cloud-login fxFill (loggedIn)="handleLoggedIn($event)" [appName]="appName" [loginPrefill]="loginPrefill" (signUp)="handleSignUp()" (useOauth)="handleUseOauth()"></tc-tibco-cloud-login>
./live-apps-login.component.css