FE-184: Интегрировать управление учеткой keycloak в ЛК (#86)

* FE-184: Интегрировать управление учеткой keycloak в ЛК
This commit is contained in:
Max Minin 2017-03-03 19:39:34 +03:00 committed by GitHub
parent fa175e8f70
commit 388a04b872
9 changed files with 78 additions and 5 deletions

View File

@ -0,0 +1,18 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { AccountComponent } from 'koffing/account/components/account.component';
@NgModule({
imports: [
RouterModule.forChild([
{
path: 'account',
component: AccountComponent
}
])
],
exports: [
RouterModule
]
})
export class AccountRoutingModule {}

View File

@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AccountComponent } from 'koffing/account/components/account.component';
import { AccountRoutingModule } from 'koffing/account/account-routing.module';
import { CommonModule } from 'koffing/common/common.module';
@NgModule({
imports: [
CommonModule,
AccountRoutingModule,
BrowserModule
],
declarations: [
AccountComponent
]
})
export class AccountModule { }
export * from './components/account.component';

View File

@ -0,0 +1,4 @@
iframe.account-frame {
width: 100%;
min-height: 800px;
}

View File

@ -0,0 +1 @@
iframe.account-frame(frameborder="0", scrolling="no", [src]="accountFrameUrl")

View File

@ -0,0 +1,25 @@
import { Component, OnInit } from '@angular/core';
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
import { AuthService } from 'koffing/auth/auth.module';
@Component({
selector: 'kof-account',
templateUrl: 'account.component.pug',
styleUrls: ['./account.component.less']
})
export class AccountComponent implements OnInit {
public accountFrameUrl: SafeResourceUrl;
constructor(
private sanitizer: DomSanitizer
) { }
public ngOnInit() {
const keycloakUrl = AuthService.getAccountInfo().authUrl;
const accountFrameUrl = `${keycloakUrl}realms/external/account/`;
this.accountFrameUrl = this.sanitizer.bypassSecurityTrustResourceUrl(accountFrameUrl);
}
}

View File

@ -1,7 +1,5 @@
export class AuthInfo {
public profileName: string = '';
public token: string = '';
public authUrl: string = '';
}

View File

@ -25,6 +25,7 @@ export class AuthService {
if (this.koffingInstance) {
result.profileName = this.koffingInstance.tokenParsed.name;
result.token = this.koffingInstance.token;
result.authUrl = this.koffingInstance.authServerUrl;
}
return result;
}

View File

@ -26,4 +26,8 @@
li
a(href="https://rbkmoney.github.io/api", target="_blank")
i.fa.fa-share-alt
| API
| API
li([routerLinkActive]="['active']")
a([routerLink]=["/account"])
i.fa.fa-user
| Мои данные

View File

@ -11,6 +11,7 @@ import { SidebarComponent } from './components/sidebar/sidebar.component';
import { TopPanelComponent } from './components/top-panel/top-panel.component';
import { ContainerComponent } from './components/container/container.component';
import { HttpErrorHandleComponent } from './components/http-error-handle/http-error-handle.component';
import { AccountModule } from 'koffing/account/account.module';
import { NotificationHandleComponent } from './components/notification-handle/notification-handle.component';
@NgModule({
@ -21,7 +22,8 @@ import { NotificationHandleComponent } from './components/notification-handle/no
BroadcasterModule,
TokenizationModule,
AnalyticsModule,
ManagementModule
ManagementModule,
AccountModule
],
declarations: [
ContainerComponent,