cipher engine
This commit is contained in:
parent
ab7fc93b14
commit
18510679bb
|
|
@ -401,6 +401,13 @@ namespace HRM.BO
|
||||||
routerLink = "/authentication/system-auditlog",
|
routerLink = "/authentication/system-auditlog",
|
||||||
icon = "pi pi-fw pi-database",
|
icon = "pi pi-fw pi-database",
|
||||||
},
|
},
|
||||||
|
new WebMenuItem()
|
||||||
|
{
|
||||||
|
uniqueName = "WEB.01.09",
|
||||||
|
label = "Cipher Engine",
|
||||||
|
routerLink = "/authentication/cipher-engine",
|
||||||
|
icon = "pi pi-fw pi-code",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -297,4 +297,7 @@ export class AuthService {
|
||||||
getIsFromUser(): boolean {
|
getIsFromUser(): boolean {
|
||||||
return this.isFromUserSubject.value;
|
return this.isFromUserSubject.value;
|
||||||
}
|
}
|
||||||
|
CipherMechanism(userData: any) {
|
||||||
|
return this.apiService.httpPost<any>('/Authentication/CipherMechanism', userData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import { UserAccessTypeComponent } from './user-access-type/user-access-type.com
|
||||||
import {ChangePasswordComponent} from './change-password/change-password.component';
|
import {ChangePasswordComponent} from './change-password/change-password.component';
|
||||||
import { DataPermssionComponent } from './data-permssion/data-permssion.component';
|
import { DataPermssionComponent } from './data-permssion/data-permssion.component';
|
||||||
import { SystemAuditTrailComponent } from './system-audittrail/system.audittrail.component';
|
import { SystemAuditTrailComponent } from './system-audittrail/system.audittrail.component';
|
||||||
|
import { CipherEngineComponent } from './cipher-engine/cipher-engine.component';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -22,6 +23,7 @@ export const routes: Routes = [
|
||||||
{ path: 'change-password', component: ChangePasswordComponent, canActivate: [AuthGuard] },
|
{ path: 'change-password', component: ChangePasswordComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'data-permssion', component: DataPermssionComponent, canActivate: [AuthGuard] },
|
{ path: 'data-permssion', component: DataPermssionComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'system-auditlog', component: SystemAuditTrailComponent, canActivate: [AuthGuard] },
|
{ path: 'system-auditlog', component: SystemAuditTrailComponent, canActivate: [AuthGuard] },
|
||||||
|
{ path: 'cipher-engine', component: CipherEngineComponent, canActivate: [AuthGuard] },
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,7 @@ import { KENDO_TREEVIEW } from '@progress/kendo-angular-treeview';
|
||||||
import { LayoutModule } from '@progress/kendo-angular-layout';
|
import { LayoutModule } from '@progress/kendo-angular-layout';
|
||||||
import { ExcelExportModule } from '@progress/kendo-angular-excel-export';
|
import { ExcelExportModule } from '@progress/kendo-angular-excel-export';
|
||||||
import { SystemAuditTrailComponent } from './system-audittrail/system.audittrail.component';
|
import { SystemAuditTrailComponent } from './system-audittrail/system.audittrail.component';
|
||||||
|
import { CipherEngineComponent } from './cipher-engine/cipher-engine.component';
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
|
@ -225,7 +226,8 @@ import { SystemAuditTrailComponent } from './system-audittrail/system.audittrail
|
||||||
ChangePasswordComponent,
|
ChangePasswordComponent,
|
||||||
UserComponent,
|
UserComponent,
|
||||||
DataPermssionComponent,
|
DataPermssionComponent,
|
||||||
SystemAuditTrailComponent
|
SystemAuditTrailComponent,
|
||||||
|
CipherEngineComponent
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
AppWindowPopUp,
|
AppWindowPopUp,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
<app-loading-panel> </app-loading-panel>
|
||||||
|
|
||||||
|
<div class="card grid marginBottomNone" style="margin: auto;">
|
||||||
|
<div class="col-12" style="margin: auto;">
|
||||||
|
<div class="textarea-wrapper">
|
||||||
|
<textarea [(ngModel)]="decryptedvalue"
|
||||||
|
rows="4" class="encryptTextArea"
|
||||||
|
placeholder="Enter text to encrypt..."></textarea>
|
||||||
|
<button *ngIf="decryptedvalue" type="button" class="clear-btn" title="clear" (click)="clearInput()">✖</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid" style="margin: auto;">
|
||||||
|
<div class="col-12" style="margin: auto;" align="middle">
|
||||||
|
<div class="textarea-wrapper">
|
||||||
|
<button kendoButton themeColor="primary"
|
||||||
|
(click)="CipherMechanism()"
|
||||||
|
(keydown.enter)="handleEnterKey($event)"
|
||||||
|
[svgIcon]="apiService.KendoSVGIcon['forward']">Execute</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card grid" style="margin: auto;">
|
||||||
|
<div class="col-12" style="margin: auto;">
|
||||||
|
<div class="textarea-wrapper">
|
||||||
|
<textarea [(ngModel)]="encryptedValue" readonly="true" placeholder="Encrypt text will appear here..."
|
||||||
|
rows="6" class="decryptTextArea">
|
||||||
|
</textarea>
|
||||||
|
<button *ngIf="encryptedValue" [svgIcon]="apiService.KendoSVGIcon['copy']" kendoButton class="copy-btn" title="Copy" (click)="copyDecryptValueToClipboard()"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
.textarea-wrapper {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
textarea.encryptTextArea {
|
||||||
|
font-size: 1rem;
|
||||||
|
padding: 0.75rem 2.5rem 0.75rem 0.75rem;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
resize: none;
|
||||||
|
width: 100%;
|
||||||
|
height: 78%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
textarea.decryptTextArea {
|
||||||
|
font-size: 1rem;
|
||||||
|
padding: 0.75rem 2.5rem 0.75rem 0.75rem;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
resize: none;
|
||||||
|
width: 100%;
|
||||||
|
height: 78%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.clear-btn {
|
||||||
|
position: absolute;
|
||||||
|
right: 10px;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
color: #888;
|
||||||
|
z-index: 10;
|
||||||
|
padding: 0;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
.clear-btn:hover {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.copy-btn {
|
||||||
|
position: absolute;
|
||||||
|
right: 10px;
|
||||||
|
top: 17%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
color: #888;
|
||||||
|
z-index: 10;
|
||||||
|
padding: 0;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
.copy-btn:hover {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.marginBottomNone{
|
||||||
|
margin-bottom: 0px !important;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
import { loadingPanelService } from './../../hrm-loding panel/loding.panel.service';
|
||||||
|
import {Component, OnInit} from '@angular/core';
|
||||||
|
import { AuthService } from 'src/app/_services/auth/auth.service';
|
||||||
|
import { ApiService } from 'src/app/app.api.service';
|
||||||
|
import { HRMNotificationService } from 'src/app/app.notification.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-cipher-engine',
|
||||||
|
templateUrl: './cipher-engine.component.html',
|
||||||
|
styleUrl: './cipher-engine.component.scss',
|
||||||
|
standalone: false,
|
||||||
|
})
|
||||||
|
export class CipherEngineComponent implements OnInit{
|
||||||
|
constructor(public notificationService: HRMNotificationService,
|
||||||
|
public authService: AuthService, public apiService: ApiService,
|
||||||
|
public loadingPanelService : loadingPanelService) {
|
||||||
|
this.apiService.selectedMenuName = 'Cipher Engine';
|
||||||
|
}
|
||||||
|
|
||||||
|
decryptedvalue : any = "";
|
||||||
|
encryptedValue : any = "";
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.decryptedvalue = "";
|
||||||
|
this.encryptedValue = "";
|
||||||
|
}
|
||||||
|
clearInput() {
|
||||||
|
this.decryptedvalue = "";
|
||||||
|
}
|
||||||
|
handleEnterKey(event: KeyboardEvent): void {
|
||||||
|
event.preventDefault();
|
||||||
|
if (this.encryptedValue?.trim()) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CipherMechanism(){
|
||||||
|
if(!this.decryptedvalue){
|
||||||
|
this.notificationService.showWarning("Please enter text to encrypt first.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const data = {
|
||||||
|
decryptedvalue : this.decryptedvalue
|
||||||
|
}
|
||||||
|
this.loadingPanelService.ShowLoadingPanel = true;
|
||||||
|
this.authService.CipherMechanism(data).subscribe(
|
||||||
|
(resp: any) => {
|
||||||
|
this.encryptedValue = resp as string;
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
this.loadingPanelService.ShowLoadingPanel = false;
|
||||||
|
this.notificationService.showError(err.error);
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
this.loadingPanelService.ShowLoadingPanel = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
copyDecryptValueToClipboard(){
|
||||||
|
if (!this.encryptedValue) return;
|
||||||
|
navigator.clipboard.writeText(this.encryptedValue).catch(() => {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -44,7 +44,9 @@ import {
|
||||||
imageIcon,
|
imageIcon,
|
||||||
shareIcon,
|
shareIcon,
|
||||||
zoomInIcon,
|
zoomInIcon,
|
||||||
zoomOutIcon
|
zoomOutIcon,
|
||||||
|
copyIcon,
|
||||||
|
forwardIcon
|
||||||
} from '@progress/kendo-svg-icons';
|
} from '@progress/kendo-svg-icons';
|
||||||
|
|
||||||
@NgModule({})
|
@NgModule({})
|
||||||
|
|
@ -93,6 +95,8 @@ export class KendoIconsModule {
|
||||||
image: imageIcon,
|
image: imageIcon,
|
||||||
share: shareIcon,
|
share: shareIcon,
|
||||||
zoomIn: zoomInIcon,
|
zoomIn: zoomInIcon,
|
||||||
zoomOut: zoomOutIcon
|
zoomOut: zoomOutIcon,
|
||||||
|
copy : copyIcon,
|
||||||
|
forward : forwardIcon
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -739,6 +739,26 @@ namespace HRM.UI.Controllers
|
||||||
return Ok(new { userToken });
|
return Ok(new { userToken });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost("CipherMechanism")]
|
||||||
|
public ActionResult CipherMechanism(dynamic data)
|
||||||
|
{
|
||||||
|
var item = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
|
||||||
|
string decryptedvalue = (string)item["decryptedvalue"].ToObject<string>();
|
||||||
|
var encryptedValue = "";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(decryptedvalue))
|
||||||
|
{
|
||||||
|
encryptedValue = Ease.NetCore.Utility.Global.CipherFunctions.Encrypt("CeLiMiTeD.AdMIn", decryptedvalue.Trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
||||||
|
}
|
||||||
|
return Ok(encryptedValue);
|
||||||
|
}
|
||||||
|
|
||||||
// Clears the HttpOnly "JWToken" cookie the API authenticates from (see Startup), so the
|
// Clears the HttpOnly "JWToken" cookie the API authenticates from (see Startup), so the
|
||||||
// session really ends on logout. Anonymous so an invalid/expired cookie can still be removed.
|
// session really ends on logout. Anonymous so an invalid/expired cookie can still be removed.
|
||||||
[HttpPost("logOut")]
|
[HttpPost("logOut")]
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,8 @@
|
||||||
//"Default": "provider=sql;sqlSyntax=SQL;server=103.197.204.164,1718;Database=MasterProjectDB;User Id=DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;",
|
//"Default": "provider=sql;sqlSyntax=SQL;server=103.197.204.164,1718;Database=MasterProjectDB;User Id=DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;",
|
||||||
//"SqlCommandConnection": "Data Source=103.197.204.164,1718;Initial Catalog=autocrop;Persist Security Info=True; User ID=DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;", // Development
|
//"SqlCommandConnection": "Data Source=103.197.204.164,1718;Initial Catalog=autocrop;Persist Security Info=True; User ID=DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;", // Development
|
||||||
|
|
||||||
"Default": "provider=sql;sqlSyntax=SQL;server=103.197.204.164,1718;Database=MasterProjectDBUATBRAC;User Id= DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;",
|
"Default": "provider=sql;sqlSyntax=SQL;server=103.197.204.164,1718;Database=MasterProjectDBBRAC;User Id= DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;",
|
||||||
"SqlCommandConnection": "Data Source=103.197.204.164,1718;Initial Catalog=MasterProjectDBUATBRAC;Persist Security Info=True; User ID=DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;" // Development
|
"SqlCommandConnection": "Data Source=103.197.204.164,1718;Initial Catalog=MasterProjectDBBRAC;Persist Security Info=True; User ID=DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;" // Development
|
||||||
|
|
||||||
},
|
},
|
||||||
"Calendar": {
|
"Calendar": {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user