Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
emiMobile
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mac Stephens
emiMobile
Commits
cf24b2b6
Commit
cf24b2b6
authored
Sep 04, 2026
by
emsys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debugging
parent
76453efa
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
66 deletions
+59
-66
Api.ServiceImpl.pas
emiMobileServer/Source/Api.ServiceImpl.pas
+3
-3
Auth.ServiceImpl.pas
emiMobileServer/Source/Auth.ServiceImpl.pas
+51
-51
emiMobileServer.dpr
emiMobileServer/emiMobileServer.dpr
+3
-1
emiMobileServer.dproj
emiMobileServer/emiMobileServer.dproj
+2
-11
No files found.
emiMobileServer/Source/Api.ServiceImpl.pas
View file @
cf24b2b6
unit
Api
.
ServiceImpl
;
unit
Api
.
ServiceImpl
;
interface
interface
...
@@ -17,8 +17,8 @@ type
...
@@ -17,8 +17,8 @@ type
strict
private
strict
private
ApiDB
:
TApiDatabaseModule
;
ApiDB
:
TApiDatabaseModule
;
private
private
procedure
AfterConstruction
;
override
;
//
procedure AfterConstruction; override;
procedure
BeforeDestruction
;
override
;
//
procedure BeforeDestruction; override;
procedure
RequireAdmin
;
procedure
RequireAdmin
;
procedure
RequireActiveDevice
;
procedure
RequireActiveDevice
;
function
OpenLemsConnection
:
TUniConnection
;
function
OpenLemsConnection
:
TUniConnection
;
...
...
emiMobileServer/Source/Auth.ServiceImpl.pas
View file @
cf24b2b6
unit
Auth
.
ServiceImpl
;
unit
Auth
.
ServiceImpl
;
interface
interface
...
@@ -22,8 +22,8 @@ type
...
@@ -22,8 +22,8 @@ type
userId
:
string
;
userId
:
string
;
userPersonnelId
:
string
;
userPersonnelId
:
string
;
userIsAdmin
:
Boolean
;
userIsAdmin
:
Boolean
;
procedure
AfterConstruction
;
override
;
//
procedure AfterConstruction; override;
procedure
BeforeDestruction
;
override
;
//
procedure BeforeDestruction; override;
function
VerifyVersion
(
ClientVersion
:
string
):
TJSONObject
;
function
VerifyVersion
(
ClientVersion
:
string
):
TJSONObject
;
function
CheckUser
(
const
User
,
Password
,
Agency
:
string
):
Integer
;
function
CheckUser
(
const
User
,
Password
,
Agency
:
string
):
Integer
;
function
Decrypt
(
inStr
,
keyStr
:
AnsiString
):
AnsiString
;
function
Decrypt
(
inStr
,
keyStr
:
AnsiString
):
AnsiString
;
...
@@ -36,7 +36,7 @@ type
...
@@ -36,7 +36,7 @@ type
signature
:
string
):
string
;
signature
:
string
):
string
;
constructor
Create
;
constructor
Create
;
destructor
Destroy
;
override
;
destructor
Destroy
;
override
;
function
Login
(
const
User
,
Password
,
Agency
:
string
):
string
;
//
function Login(const User, Password, Agency: string): string;
function
GetAgencieslist
():
TAgenciesList
;
function
GetAgencieslist
():
TAgenciesList
;
function
GetAgencyConfiglist
:
TAgencyConfigList
;
function
GetAgencyConfiglist
:
TAgencyConfigList
;
function
BeginRegistration
(
const
PhoneNumber
:
string
):
TJSONObject
;
function
BeginRegistration
(
const
PhoneNumber
:
string
):
TJSONObject
;
...
@@ -819,53 +819,53 @@ begin
...
@@ -819,53 +819,53 @@ begin
end
;
end
;
end
;
end
;
//
function
TAuthService
.
Login
(
const
User
,
Password
,
Agency
:
string
):
string
;
//
function TAuthService.Login(const User, Password, Agency: string): string;
var
//
var
userState
:
Integer
;
//
userState: Integer;
JWT
:
TJWT
;
//
JWT: TJWT;
begin
//
begin
Logger
.
Log
(
1
,
Format
(
'AuthService.Login - User: "%s" Agency: "%s"'
,
[
User
,
Agency
]));
//
Logger.Log(1, Format('AuthService.Login - User: "%s" Agency: "%s"', [User, Agency]));
userState
:=
CheckUser
(
User
,
Password
,
Agency
);
//
userState := CheckUser(User, Password, Agency);
//
try
//
try
userState
:=
CheckUser
(
User
,
Password
,
Agency
);
//
userState := CheckUser(User, Password, Agency);
except
//
except
on
E
:
Exception
do
//
on E: Exception do
begin
//
begin
Logger
.
Log
(
2
,
'AuthService.Login - CheckUser error: '
+
E
.
ClassName
+
': '
+
E
.
Message
);
//
Logger.Log(2, 'AuthService.Login - CheckUser error: ' + E.ClassName + ': ' + E.Message);
raise
EXDataHttpException
.
Create
(
500
,
'Login failed'
);
//
raise EXDataHttpException.Create(500, 'Login failed');
end
;
//
end;
end
;
//
end;
//
if
userState
=
0
then
//
if userState = 0 then
begin
//
begin
Logger
.
Log
(
2
,
Format
(
'AuthService.Login - invalid login for User: "%s" Agency: "%s"'
,
[
User
,
Agency
]));
//
Logger.Log(2, Format('AuthService.Login - invalid login for User: "%s" Agency: "%s"', [User, Agency]));
raise
EXDataHttpUnauthorized
.
Create
(
'Invalid user or password'
);
//
raise EXDataHttpUnauthorized.Create('Invalid user or password');
end
;
//
end;
//
if
userState
=
1
then
//
if userState = 1 then
begin
//
begin
Logger
.
Log
(
2
,
Format
(
'AuthService.Login - inactive user: "%s" Agency: "%s"'
,
[
User
,
Agency
]));
//
Logger.Log(2, Format('AuthService.Login - inactive user: "%s" Agency: "%s"', [User, Agency]));
raise
EXDataHttpUnauthorized
.
Create
(
'User not active'
);
//
raise EXDataHttpUnauthorized.Create('User not active');
end
;
//
end;
//
JWT
:=
TJWT
.
Create
;
//
JWT := TJWT.Create;
try
//
try
JWT
.
Claims
.
JWTId
:=
LowerCase
(
Copy
(
TUtils
.
GuidToVariant
(
TUtils
.
NewGuid
),
2
,
36
));
//
JWT.Claims.JWTId := LowerCase(Copy(TUtils.GuidToVariant(TUtils.NewGuid), 2, 36));
JWT
.
Claims
.
IssuedAt
:=
Now
;
//
JWT.Claims.IssuedAt := Now;
JWT
.
Claims
.
Expiration
:=
IncHour
(
Now
,
24
);
//
JWT.Claims.Expiration := IncHour(Now, 24);
JWT
.
Claims
.
SetClaimOfType
<
string
>(
'user_name'
,
userName
);
//
JWT.Claims.SetClaimOfType<string>('user_name', userName);
JWT
.
Claims
.
SetClaimOfType
<
string
>(
'user_fullname'
,
userFullName
);
//
JWT.Claims.SetClaimOfType<string>('user_fullname', userFullName);
JWT
.
Claims
.
SetClaimOfType
<
string
>(
'user_agency'
,
userAgency
);
//
JWT.Claims.SetClaimOfType<string>('user_agency', userAgency);
JWT
.
Claims
.
SetClaimOfType
<
string
>(
'user_badge'
,
userBadge
);
//
JWT.Claims.SetClaimOfType<string>('user_badge', userBadge);
JWT
.
Claims
.
SetClaimOfType
<
string
>(
'user_id'
,
userId
);
//
JWT.Claims.SetClaimOfType<string>('user_id', userId);
JWT
.
Claims
.
SetClaimOfType
<
string
>(
'user_personnelid'
,
userPersonnelId
);
//
JWT.Claims.SetClaimOfType<string>('user_personnelid', userPersonnelId);
Result
:=
TJOSE
.
SHA256CompactToken
(
ServerConfig
.
jwtTokenSecret
,
JWT
);
//
Result := TJOSE.SHA256CompactToken(ServerConfig.jwtTokenSecret, JWT);
finally
//
finally
JWT
.
Free
;
//
JWT.Free;
end
;
//
end;
end
;
//
end;
function
TAuthService
.
CheckUser
(
const
User
,
Password
,
Agency
:
string
):
Integer
;
function
TAuthService
.
CheckUser
(
const
User
,
Password
,
Agency
:
string
):
Integer
;
var
var
...
...
emiMobileServer/emiMobileServer.dpr
View file @
cf24b2b6
...
@@ -31,7 +31,9 @@ uses
...
@@ -31,7 +31,9 @@ uses
Ws.Server.Module in 'Source\Ws.Server.Module.pas' {WsServerModule: TDataModule},
Ws.Server.Module in 'Source\Ws.Server.Module.pas' {WsServerModule: TDataModule},
Ws.DataModel in 'Source\Ws.DataModel.pas',
Ws.DataModel in 'Source\Ws.DataModel.pas',
WsMessages in 'Source\shared\WsMessages.pas',
WsMessages in 'Source\shared\WsMessages.pas',
WebSocket.Manager in 'Source\WebSocket.Manager.pas';
WebSocket.Manager in 'Source\WebSocket.Manager.pas',
Webauthn.Cbor in 'Source\Webauthn.Cbor.pas',
Webauthn.Crypto in 'Source\Webauthn.Crypto.pas';
type
type
TMemoLogAppender = class( TInterfacedObject, ILogAppender )
TMemoLogAppender = class( TInterfacedObject, ILogAppender )
...
...
emiMobileServer/emiMobileServer.dproj
View file @
cf24b2b6
...
@@ -180,6 +180,8 @@
...
@@ -180,6 +180,8 @@
<DCCReference Include="Source\Ws.DataModel.pas"/>
<DCCReference Include="Source\Ws.DataModel.pas"/>
<DCCReference Include="Source\shared\WsMessages.pas"/>
<DCCReference Include="Source\shared\WsMessages.pas"/>
<DCCReference Include="Source\WebSocket.Manager.pas"/>
<DCCReference Include="Source\WebSocket.Manager.pas"/>
<DCCReference Include="Source\Webauthn.Cbor.pas"/>
<DCCReference Include="Source\Webauthn.Crypto.pas"/>
<BuildConfiguration Include="Base">
<BuildConfiguration Include="Base">
<Key>Base</Key>
<Key>Base</Key>
</BuildConfiguration>
</BuildConfiguration>
...
@@ -872,9 +874,6 @@
...
@@ -872,9 +874,6 @@
<Platform Name="Win64x">
<Platform Name="Win64x">
<Operation>1</Operation>
<Operation>1</Operation>
</Platform>
</Platform>
<Platform Name="WinARM64EC">
<Operation>1</Operation>
</Platform>
</DeployClass>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceDebug">
<DeployClass Name="ProjectiOSDeviceDebug">
<Platform Name="iOSDevice32">
<Platform Name="iOSDevice32">
...
@@ -945,10 +944,6 @@
...
@@ -945,10 +944,6 @@
<RemoteDir>Assets</RemoteDir>
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
<Operation>1</Operation>
</Platform>
</Platform>
<Platform Name="WinARM64EC">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
</DeployClass>
<DeployClass Name="UWP_DelphiLogo44">
<DeployClass Name="UWP_DelphiLogo44">
<Platform Name="Win32">
<Platform Name="Win32">
...
@@ -959,10 +954,6 @@
...
@@ -959,10 +954,6 @@
<RemoteDir>Assets</RemoteDir>
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
<Operation>1</Operation>
</Platform>
</Platform>
<Platform Name="WinARM64EC">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
</DeployClass>
<DeployClass Name="iOS_AppStore1024">
<DeployClass Name="iOS_AppStore1024">
<Platform Name="iOSDevice64">
<Platform Name="iOSDevice64">
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment