Compare commits

...

3 Commits

Author SHA1 Message Date
Ichen Chhoeng
ff0e97e36b blah 2025-11-17 11:25:33 +07:00
Ichen Chhoeng
cc3a2c0e52 remove env 2025-11-10 11:31:08 +07:00
Ichen Chhoeng
77a701bc9c Stop tracking bin and obj folders 2025-11-07 11:58:03 +07:00
128 changed files with 1317 additions and 2821 deletions

8
.env
View File

@ -1,8 +0,0 @@
GRPC_GDIONLINE_ADDRESS=https://oldapi.example.com:5001
KYC_BASE_URL=https://ocr-provider.example.com
Consul__Address=http://localhost:8500
# Consul__Address=http://consul:8500
# Grpc__GDIOnline__Address=https://gdi-online-service:5001
# Sms__BaseUrl=https://sms-service:443
# Ocr__BaseUrl=https://ocr-service:443

View File

@ -1 +1,9 @@
DATABASE_USERNAME=
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASS=postgres
DB_NAME=khmereid_backend_db
DB_SSL_MODE=Disable
Kyc__EKYC_Solutions__BaseUrl=
Kyc__EKYC_Solutions__PrivateKey=

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# Build artifacts
**/bin/
**/obj/
.env

View File

@ -3,17 +3,17 @@ FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /app
# Copy the project files
COPY khmer_eid_backend/*.csproj ./
COPY khmereid_backend/*.csproj ./
# Restore dependencies
RUN dotnet restore
# Copy the rest of the application code
COPY khmer_eid_backend/ ./
COPY khmereid_backend/ ./
# Build the application
# Change to Release for prod
RUN dotnet publish khmer_eid_backend.csproj -c Debug -o out
RUN dotnet publish khmereid_backend.csproj -c Debug -o out
# Use the .NET runtime image for running the application
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
@ -23,11 +23,11 @@ WORKDIR /app
COPY --from=build /app/out ./
# Copy Program.cs into the runtime image so you can inspect it
COPY khmer_eid_backend/Program.cs ./
COPY khmereid_backend/Program.cs ./
# Install vim
RUN apt-get update && apt-get install -y vim && rm -rf /var/lib/apt/lists/*
# Expose the port and run the application
EXPOSE 5000
ENTRYPOINT ["dotnet", "khmer_eid_backend.dll"]
ENTRYPOINT ["dotnet", "khmereid_backend.dll"]

View File

@ -1,32 +1,41 @@
.PHONY: dev-up dev-down prod-up prod-down logs build
.PHONY: bootstrap, dev
dev-up:
docker compose -f docker-compose.dev.yml up -d --remove-orphans
bootstrap:
@echo "Creating kind cluster 'khmereid' if it doesn't exist..."
@if ! kind get clusters | grep -q '^khmereid$$'; then \
kind create cluster --name khmereid; \
else \
echo "Cluster 'khmereid' already exists, skipping creation"; \
fi
dev-down:
docker compose -f docker-compose.dev.yml down
@echo "Applying Kubernetes bootstrap manifests..."
@kubectl apply -k k8s/bootstrap
@kubectl apply -f k8s/bootstrap/bootstrap.yml
dev-restore:
docker compose -f docker-compose.dev.yml run khmer-eid-api dotnet restore
@echo "Waiting for namespace 'envoy-gateway-system' to appear..."
@while ! kubectl get namespace envoy-gateway-system >/dev/null 2>&1; do \
printf "."; sleep 2; \
done; \
echo "\nNamespace 'envoy-gateway-system' is ready!"
dev-build:
docker compose -f docker-compose.dev.yml build
@echo "Waiting for all pods in all namespaces to be ready (timeout 10 minutes)..."
@kubectl wait --for=condition=Ready pod --all --all-namespaces --timeout=600s
@echo "All pods are ready!"
dev-list-packages:
docker exec -it khmer-eid-api-dev dotnet list package
dev-exec:
docker exec -it khmer-eid-api-dev /bin/bash
prod-up:
docker compose -f docker-compose.prod.yml up -d
prod-down:
docker compose -f docker-compose.prod.yml down
dev-logs:
docker compose -f docker-compose.dev.yml logs -f khmer-eid-api
prod-logs:
docker compose -f docker-compose.prod.yml logs -f khmer-eid-api
dev-migrate:
@skaffold run --cleanup=false
@sleep 5
@cd khmereid_backend && dotnet ef database update
@echo "Waiting for all pods in all namespaces to be ready (timeout 10 minutes)..."
@kubectl wait --for=condition=Ready pod --all --all-namespaces --timeout=600s
dev:
@echo "Running Skaffold to build and deploy once..."
@skaffold run --cleanup=false
@echo "Starting local development environment..."
# Port-forward Kratos
@kubectl port-forward svc/kratos-app-public 4433:80 &
# Wait a moment for port-forwards to initialize
@sleep 5
# Run dotnet in watch mode
@cd khmereid_backend && dotnet watch run --urls http://localhost:5200

View File

@ -1,22 +1,42 @@
### In order to add a new package, run the following commands
1. dotnet add package <PackageName>
2. dotnet resotre
3. docker compose build
4. docker compose up
## Quick Start (Local Development)
### Prerequisites
Make sure you have:
### config kratos
create schema kratos
- [.NET 9 SDK](https://dotnet.microsoft.com/en-us/download)
- [Docker](https://www.docker.com/)
- kind ```brew install kind```
- skaffold ```brew install skaffold```
- PostgreSQL
docker exec -it kratos kratos migrate sql \
"postgres://dev:dev@postgres:5432/backend_db?sslmode=disable&search_path=kratos" \
-y
---
### Clone and set up
### config hanko
create schema hanko
1. Clone the repository and navigate into it:
```bash
git clone https://github.com/khmer-eid/khmereid-backend.git
cd khmereid-backend
```
docker compose run --rm hanko migrate up
2. Bootstrap the environment:
```bash
make bootstrap
```
docker compose up -d hanko
3. Set up environment variables:
```bash
cp .env.example .env
# update db config part your .env
```
4. Run database migrations:
```bash
make dev-migrate
```
5. Start the development server:
```bash
make dev
```

View File

@ -1,5 +1,5 @@
version: v1.3.0
dsn: "postgres://dev:dev@postgres:5432/backend_db?sslmode=disable&search_path=kratos"
dsn: ${DSN}
log:
leak_sensitive_values: true
@ -31,14 +31,14 @@ identity:
default_schema_id: default
schemas:
- id: default
url: file:///etc/config/identity.schema.json
url: file:///etc/config/custom/identity.schema.json
courier:
channels:
- id: sms
type: http
request_config:
method: POST
url: https://webhook.site/b9e137a6-f184-47b5-ac43-50c95a95cd14
url: https://webhook.site/d67a9ea6-e152-4d7f-8432-7ab92b2ace1f
body: base64://ZnVuY3Rpb24oY3R4KSB7CiAgcmVjaXBpZW50OiBjdHgucmVjaXBpZW50LAogIHRlbXBsYXRlX3R5cGU6IGN0eC50ZW1wbGF0ZV90eXBlLAogIHRvOiBpZiAidGVtcGxhdGVfZGF0YSIgaW4gY3R4ICYmICJ0byIgaW4gY3R4LnRlbXBsYXRlX2RhdGEgdGhlbiBjdHgudGVtcGxhdGVfZGF0YS50byBlbHNlIG51bGwsCiAgcmVjb3ZlcnlfY29kZTogaWYgInRlbXBsYXRlX2RhdGEiIGluIGN0eCAmJiAicmVjb3ZlcnlfY29kZSIgaW4gY3R4LnRlbXBsYXRlX2RhdGEgdGhlbiBjdHgudGVtcGxhdGVfZGF0YS5yZWNvdmVyeV9jb2RlIGVsc2UgbnVsbCwKICByZWNvdmVyeV91cmw6IGlmICJ0ZW1wbGF0ZV9kYXRhIiBpbiBjdHggJiYgInJlY292ZXJ5X3VybCIgaW4gY3R4LnRlbXBsYXRlX2RhdGEgdGhlbiBjdHgudGVtcGxhdGVfZGF0YS5yZWNvdmVyeV91cmwgZWxzZSBudWxsLAogIHZlcmlmaWNhdGlvbl91cmw6IGlmICJ0ZW1wbGF0ZV9kYXRhIiBpbiBjdHggJiYgInZlcmlmaWNhdGlvbl91cmwiIGluIGN0eC50ZW1wbGF0ZV9kYXRhIHRoZW4gY3R4LnRlbXBsYXRlX2RhdGEudmVyaWZpY2F0aW9uX3VybCBlbHNlIG51bGwsCiAgdmVyaWZpY2F0aW9uX2NvZGU6IGlmICJ0ZW1wbGF0ZV9kYXRhIiBpbiBjdHggJiYgInZlcmlmaWNhdGlvbl9jb2RlIiBpbiBjdHgudGVtcGxhdGVfZGF0YSB0aGVuIGN0eC50ZW1wbGF0ZV9kYXRhLnZlcmlmaWNhdGlvbl9jb2RlIGVsc2UgbnVsbCwKICBzdWJqZWN0OiBjdHguc3ViamVjdCwKICBib2R5OiBjdHguYm9keQp9Cg==
headers:
content-type: application/json

View File

@ -1,19 +0,0 @@
{
"log": {
"level": "info"
},
"playground": {
"enabled": true,
"port": 3000
},
"datastore": {
"engine": "postgres",
"uri": "postgres://dev:dev@postgres:5432/backend_db?sslmode=disable&search_path=openfga"
},
"grpc": {
"addr": ":8081"
},
"http": {
"addr": ":8080"
}
}

View File

@ -1,19 +0,0 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: cnpg-app
namespace: argocd
spec:
syncPolicy:
automated:
enabled: true
syncOptions:
- ServerSideApply=true
project: default
source:
chart: cloudnative-pg
repoURL: 'https://cloudnative-pg.github.io/charts'
targetRevision: 0.26.1
destination:
namespace: default
server: 'https://kubernetes.default.svc'

View File

@ -1,3 +1,6 @@
# ==============================
# Kratos Application
# ==============================
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
@ -15,6 +18,10 @@ spec:
targetRevision: 0.58.0
helm:
valuesObject:
statefulSet:
extraArgs:
- --config
- /etc/config/custom/kratos.yaml
deployment:
extraVolumes:
- name: kratos-custom-config
@ -30,77 +37,17 @@ spec:
secretKeyRef:
name: postgres-kratos-app
key: uri
extraArgs:
- --config
- /etc/config/custom/kratos.yaml
kratos:
# config db
log:
leak_sensitive_values: true
automigration:
enabled: true
config:
dsn:
valueFrom:
secretKeyRef:
name: postgres-kratos-app
key: uri
selfservice:
methods:
code:
enabled: true
passwordless_enabled: true
lifespan: 2m
password:
enabled: true
default_browser_return_url: "http://localhost:4433"
flows:
login:
ui_url: "http://localhost:5200/auth/login"
registration:
after:
password:
hooks:
- hook: session
code:
hooks:
- hook: session
ui_url: "http://localhost:5200/auth/register"
verification:
ui_url: "http://localhost:5200/auth/verify"
enabled: true
identity:
default_schema_id: default
schemas:
- id: default
url: file:///etc/config/custom/identity.schema.json
courier:
channels:
- id: sms
type: http
request_config:
method: POST
url: https://webhook.site/b9e137a6-f184-47b5-ac43-50c95a95cd14
body: base64://ZnVuY3Rpb24oY3R4KSB7CiAgcmVjaXBpZW50OiBjdHgucmVjaXBpZW50LAogIHRlbXBsYXRlX3R5cGU6IGN0eC50ZW1wbGF0ZV90eXBlLAogIHRvOiBpZiAidGVtcGxhdGVfZGF0YSIgaW4gY3R4ICYmICJ0byIgaW4gY3R4LnRlbXBsYXRlX2RhdGEgdGhlbiBjdHgudGVtcGxhdGVfZGF0YS50byBlbHNlIG51bGwsCiAgcmVjb3ZlcnlfY29kZTogaWYgInRlbXBsYXRlX2RhdGEiIGluIGN0eCAmJiAicmVjb3ZlcnlfY29kZSIgaW4gY3R4LnRlbXBsYXRlX2RhdGEgdGhlbiBjdHgudGVtcGxhdGVfZGF0YS5yZWNvdmVyeV9jb2RlIGVsc2UgbnVsbCwKICByZWNvdmVyeV91cmw6IGlmICJ0ZW1wbGF0ZV9kYXRhIiBpbiBjdHggJiYgInJlY292ZXJ5X3VybCIgaW4gY3R4LnRlbXBsYXRlX2RhdGEgdGhlbiBjdHgudGVtcGxhdGVfZGF0YS5yZWNvdmVyeV91cmwgZWxzZSBudWxsLAogIHZlcmlmaWNhdGlvbl91cmw6IGlmICJ0ZW1wbGF0ZV9kYXRhIiBpbiBjdHggJiYgInZlcmlmaWNhdGlvbl91cmwiIGluIGN0eC50ZW1wbGF0ZV9kYXRhIHRoZW4gY3R4LnRlbXBsYXRlX2RhdGEudmVyaWZpY2F0aW9uX3VybCBlbHNlIG51bGwsCiAgdmVyaWZpY2F0aW9uX2NvZGU6IGlmICJ0ZW1wbGF0ZV9kYXRhIiBpbiBjdHggJiYgInZlcmlmaWNhdGlvbl9jb2RlIiBpbiBjdHgudGVtcGxhdGVfZGF0YSB0aGVuIGN0eC50ZW1wbGF0ZV9kYXRhLnZlcmlmaWNhdGlvbl9jb2RlIGVsc2UgbnVsbCwKICBzdWJqZWN0OiBjdHguc3ViamVjdCwKICBib2R5OiBjdHguYm9keQp9Cg==
headers:
content-type: application/json
templates:
verification_code:
valid:
sms:
body:
plaintext: "base64://WW91ciB2ZXJpZmljYXRpb24gY29kZSBpczoge3sgLlZlcmlmaWNhdGlvbkNvZGUgfX0="
email:
body:
plaintext: "base64://WW91ciB2ZXJpZmljYXRpb24gY29kZSBpczoge3sgLlZlcmlmaWNhdGlvbkNvZGUgfX0="
login_code:
valid:
sms:
body:
plaintext: "base64://WW91ciBsb2dpbiBjb2RlIGlzOiB7eyAuTG9naW5Db2RlIH19"
email:
body:
plaintext: "base64://WW91ciB2ZXJpZmljYXRpb24gY29kZSBpczoge3sgLlZlcmlmaWNhdGlvbkNvZGUgfX0="
image:
repository: shadowlegend/ory-kratos
tag: master-arm64
destination:
namespace: default
server: 'https://kubernetes.default.svc'

View File

@ -1,80 +0,0 @@
# ==============================
# Ory Kratos Deployment + Service
# ==============================
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: kratos
spec:
selector:
matchLabels:
app: kratos
template:
metadata:
labels:
app: kratos
spec:
volumes:
- name: kratos-config
configMap:
name: kratos-config
initContainers:
- name: kratos-migrate
image: shadowlegend/ory-kratos@sha256:1e2a07fa1406c90eb2a16df5da509d163db394262c1a91baf73cc32009dcccd6
env:
- name: DSN
valueFrom:
secretKeyRef:
name: postgres-kratos-app
key: uri
command:
- sh
- -c
- kratos migrate sql -e --yes
containers:
- name: kratos
image: shadowlegend/ory-kratos@sha256:1e2a07fa1406c90eb2a16df5da509d163db394262c1a91baf73cc32009dcccd6
env:
- name: DSN
valueFrom:
secretKeyRef:
name: postgres-kratos-app
key: uri
- name: KRATOS_LOG_LEVEL
value: "info"
command:
- kratos
- serve
- --watch-courier
- --config
- /etc/config/kratos.yml
resources:
limits:
memory: "128Mi"
cpu: "500m"
requests:
memory: 64Mi
cpu: 20m
ports:
- containerPort: 4433
- containerPort: 4434
volumeMounts:
- name: kratos-config
mountPath: /etc/config
---
apiVersion: v1
kind: Service
metadata:
name: kratos
spec:
selector:
app: kratos
ports:
- name: public
port: 4433
targetPort: 4433
- name: admin
port: 4434
targetPort: 4434

View File

@ -3,20 +3,16 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- app-kratos.yml
- app-cnpg.yml
- app-envoy.yml
- envoy.yml
# - kratos.yml
# - deployment.yml
- app-kratos.yml
- postgres-dotnet.yml
- postgres-kratos.yml
- deployment.yml
# - app-khmereid.yml
configMapGenerator:
- name: kratos-config
files:
- kratos.yml=../../config/kratos/kratos.yml
- kratos.yaml=../../config/kratos/kratos.yml
- identity.schema.json=../../config/kratos/identity.schema.json
generatorOptions:
disableNameSuffixHash: true

View File

@ -2,7 +2,7 @@ apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: postgres-dotnet
namespace: argocd
namespace: default
annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
spec:

View File

@ -3,7 +3,6 @@ kind: Cluster
metadata:
name: postgres-kratos
namespace: default
# namespace: argocd
annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
spec:

View File

@ -1,5 +1,26 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: cnpg-app
namespace: argocd
spec:
syncPolicy:
automated:
enabled: true
syncOptions:
- ServerSideApply=true
project: default
source:
chart: cloudnative-pg
repoURL: 'https://cloudnative-pg.github.io/charts'
targetRevision: 0.26.1
destination:
namespace: default
server: 'https://kubernetes.default.svc'
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: envoy-app
namespace: argocd
@ -22,6 +43,5 @@ spec:
agent:
enabled: true
destination:
# namespace: default
namespace: envoy-gateway-system
server: 'https://kubernetes.default.svc'
server: 'https://kubernetes.default.svc'

View File

@ -0,0 +1,17 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: argocd
resources:
- namespaces.yml
- https://raw.githubusercontent.com/argoproj/argo-cd/v3.1.9/manifests/install.yaml
patches:
- patch: |-
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-cm
data:
kustomize.buildOptions: --enable-helm --load-restrictor LoadRestrictionsNone

View File

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: argocd

View File

@ -2,16 +2,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../base
- nginx-temp.yml
patches:
- target:
kind: Deployment
name: argocd-repo-server
namespace: argocd
patch: |-
- op: add
path: /spec/template/spec/containers/0/env/-
value:
name: ARGOCD_APP_SOURCE_PATH_RESTRICTION
value: repo
- nginx-temp.yml

18
k8s/uat/app.yml Normal file
View File

@ -0,0 +1,18 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: khmereid-app
namespace: argocd
spec:
syncPolicy:
automated:
prune: true
enabled: true
project: default
source:
repoURL: 'https://gitea.internal.ekycsolutions.com/xadminx/khmereid-backend-temp.git'
path: k8s/uat
targetRevision: main
destination:
namespace: default
server: 'https://kubernetes.default.svc'

View File

@ -1,4 +1,17 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../base
- ../base
# secretGenerator:
# - name: crime-management-system-deployment-repo
# namespace: argocd
# envs:
# - .env.cms-deploy-repo-cred
# literals:
# - type=git
# - project=default
# - url=https://github.com/EKYCSolutions/crime-management-system.git
# options:
# labels:
# argocd.argoproj.io/secret-type: repository

View File

@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.2.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "khmer_eid_backend", "khmer_eid_backend\khmer_eid_backend.csproj", "{6D4F6FF4-86EE-BD7D-7691-D7FD0BC6AFAB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "khmereid_backend", "khmereid_backend\khmereid_backend.csproj", "{6D4F6FF4-86EE-BD7D-7691-D7FD0BC6AFAB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -1,48 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using khmer_eid_backend.Integrations.Ory;
using khmer_eid_backend.Requests;
using Microsoft.AspNetCore.Authorization;
namespace khmer_eid_backend.Controllers
{
[ApiController]
[Route("auth")]
public class AuthController(KratosIntegration _kratos) : ControllerBase
{
[HttpPost("request-signup-otp")]
public async Task<IActionResult> RequestSignupOtp([FromForm] SignupRequest request)
{
var data = await _kratos.CreateOtpRegistrationFlowAsync(phone: request.Phone);
return Ok(new { Message = "OTP sent if the phone number is valid.", data });
}
[HttpPost("verify-signup-otp")]
public async Task<IActionResult> VerifySignupOtp([FromForm] string phone,[FromForm] string otp, [FromForm] string flowId)
{
var data = await _kratos.CompleteOtpRegistrationFlowAsync(flowId, phone, otp);
return Ok(new { Message = "OTP verified successfully.", data });
}
[HttpPost("request-login-otp")]
public async Task<IActionResult> RequestLoginOtp([FromForm] string phone)
{
var data = await _kratos.CreateOtpLoginFlowAsync(phone: phone);
return Ok(new { Message = "OTP sent if the phone number is valid.", data });
}
[HttpPost("verify-login-otp")]
public async Task<IActionResult> VerifyLoginOtp([FromForm] string phone, [FromForm] string otp, [FromForm] string flowId)
{
var data = await _kratos.CompleteOtpLoginFlowAsync(flowId, phone, otp);
return Ok(new { Message = "OTP verified successfully.", data });
}
[HttpPost("logout")]
[Authorize(AuthenticationSchemes = "Kratos")]
public async Task<IActionResult> Logout()
{
var data = await _kratos.Logout(Request.Headers.Authorization.ToString().Replace("Bearer ",""));
return Ok(new { Message = "Logged out successfully."});
}
}
}

View File

@ -1,24 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using khmer_eid_backend.Integrations.Ory;
using Microsoft.AspNetCore.Authorization;
using System.Security.Claims;
namespace khmer_eid_backend.Controllers;
public class UserController(KratosIntegration _kratos) : ControllerBase
{
[HttpGet("me")]
[Authorize(AuthenticationSchemes = "Kratos")]
// public Task<IActionResult> Me()
// {
// var id = User.FindFirstValue(ClaimTypes.NameIdentifier);
// var phone = User.FindFirstValue("phone");
// // return Ok(new { id, phone });
// return Task.FromResult<IActionResult>(Ok(new { id, phone }));
// }
public async Task<IActionResult> Me()
{
var data = await _kratos.GetMe(Request.Headers.Authorization.ToString().Replace("Bearer ",""));
return Ok(data);
}
}

View File

@ -1,52 +0,0 @@
using Ory.Kratos.Client.Api;
using System.Security.Claims;
using Ory.Kratos.Client.Client;
using System.Text.Encodings.Web;
using Microsoft.Extensions.Options;
using Microsoft.AspNetCore.Authentication;
namespace khmer_eid_backend.Integrations.Ory;
public class KratosHandler : AuthenticationHandler<AuthenticationSchemeOptions>
{
private readonly FrontendApi _frontendApi;
public KratosHandler(
IOptionsMonitor<AuthenticationSchemeOptions> options,
ILoggerFactory logger,
UrlEncoder encoder,
IConfiguration config)
: base(options, logger, encoder)
{
var cfg = new Configuration { BasePath = config["Ory:Kratos:PublicUrl"]! };
_frontendApi = new FrontendApi(cfg);
}
protected override async Task<AuthenticateResult> HandleAuthenticateAsync()
{
var authHeader = Request.Headers["Authorization"].ToString();
if (string.IsNullOrWhiteSpace(authHeader) || !authHeader.StartsWith("Bearer "))
return AuthenticateResult.NoResult();
var token = authHeader.Substring("Bearer ".Length).Trim();
try
{
var session = await _frontendApi.ToSessionAsync(xSessionToken: token);
var identity = new ClaimsIdentity(new[]
{
new Claim(ClaimTypes.NameIdentifier, session.Identity.Id),
new Claim("phone", session.Identity.Traits.ToString() ?? "")
}, Scheme.Name);
var principal = new ClaimsPrincipal(identity);
return AuthenticateResult.Success(new AuthenticationTicket(principal, Scheme.Name));
}
catch (Exception ex)
{
Logger.LogError(ex, "Failed to authenticate Kratos session");
return AuthenticateResult.Fail("Invalid Kratos session token");
}
}
}

View File

@ -1,193 +0,0 @@
using System.Text.Json;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Model;
using Ory.Kratos.Client.Client;
namespace khmer_eid_backend.Integrations.Ory;
public class KratosIntegration
{
private readonly FrontendApi _frontendApi;
private readonly IdentityApi _identityApi;
private readonly ILogger<KratosIntegration> _logger;
public KratosIntegration(IConfiguration config, ILogger<KratosIntegration> logger)
{
var publicCfg = new Configuration { BasePath = config["Ory:Kratos:PublicUrl"]! };
var adminCfg = new Configuration { BasePath = config["Ory:Kratos:AdminUrl"]! };
_frontendApi = new FrontendApi(publicCfg);
_identityApi = new IdentityApi(adminCfg);
_logger = logger;
}
public async Task<dynamic> CreateOtpRegistrationFlowAsync(string phone)
{
var flow = await _frontendApi.CreateNativeRegistrationFlowAsync(returnSessionTokenExchangeCode: true);
_logger.LogInformation("Started registration flow: {FlowId}", flow.Id);
phone = phone.Trim();
var method = new KratosUpdateRegistrationFlowWithCodeMethod(
traits: new { phone = phone },
method: "code"
);
try
{
var body = new KratosUpdateRegistrationFlowBody(method);
_logger.LogInformation("Updating OTP registration flow for {Phone}, flow {FlowId}", phone, flow.Id);
var updatedFlow = _frontendApi.UpdateRegistrationFlow(flow.Id, body);
return flow;
}
catch (ApiException ex)
{
var res = JsonSerializer.Deserialize<JsonElement>(ex.ErrorContent.ToString()!);
return ex.ErrorCode switch
{
400 => res.GetProperty("state").ToString() == "sent_email" ?
new
{
FlowId = res.GetProperty("id").GetString(),
State = res.GetProperty("state").GetString(),
ExpiredAt = res.GetProperty("expires_at").GetDateTime()
} : throw new Exception("Unhandled Kratos API exception: " + ex.Message),
_ => throw new Exception("Unhandled Kratos API exception: " + ex.Message),
};
}
}
public async Task<dynamic> CompleteOtpRegistrationFlowAsync(string flowId, string phone,string otp)
{
phone = phone.Trim();
var method = new KratosUpdateRegistrationFlowWithCodeMethod(
code: otp,
traits: new { phone = phone},
method: "code"
);
var body = new KratosUpdateRegistrationFlowBody(method);
try
{
var result = await _frontendApi.UpdateRegistrationFlowAsync(flowId, body);
_logger.LogInformation("Completed OTP registration flow for flow {FlowId}", flowId);
return new
{
accessToken = result.SessionToken,
expiredAt = result.Session?.ExpiresAt
};
}
catch (ApiException ex)
{
var res = JsonSerializer.Deserialize<JsonElement>(ex.ErrorContent.ToString()!);
return ex.ErrorCode switch
{
400 => res.GetProperty("ui").GetProperty("messages").EnumerateArray().First().GetProperty("text").GetString()!,
404 => throw new Exception("Registration flow not found."),
_ => throw new Exception("Unhandled Kratos API exception: " + ex.Message),
};
}
}
public async Task<dynamic> CreateOtpLoginFlowAsync(string phone)
{
var flow = await _frontendApi.CreateNativeLoginFlowAsync(returnSessionTokenExchangeCode: true);
_logger.LogInformation("Started login flow: {FlowId}", flow.Id);
phone = phone.Trim();
var method = new KratosUpdateLoginFlowWithCodeMethod(
method: "code",
csrfToken: "dfdfdfde",
identifier: phone
);
try
{
var body = new KratosUpdateLoginFlowBody(method);
_logger.LogInformation("Updating OTP registration flow for {Phone}, flow {FlowId}", phone, flow.Id);
var updatedFlow = await _frontendApi.UpdateLoginFlowAsync(flow.Id, body);
return flow;
}
catch (ApiException ex)
{
var res = JsonSerializer.Deserialize<JsonElement>(ex.ErrorContent.ToString()!);
return ex.ErrorCode switch
{
400 => res.GetProperty("state").ToString() == "sent_email" ?
new
{
FlowId = res.GetProperty("id").GetString(),
State = res.GetProperty("state").GetString(),
ExpiredAt = res.GetProperty("expires_at").GetDateTime()
} : throw new Exception("Unhandled Kratos API exception: " + ex.Message),
_ => throw new Exception("Unhandled Kratos API exception: " + ex.Message),
};
}
}
public async Task<dynamic> CompleteOtpLoginFlowAsync(string flowId, string phone, string otp)
{
phone = "+" + phone.Trim();
var method = new KratosUpdateLoginFlowWithCodeMethod(
code: otp,
method: "code",
csrfToken: "dfdfdfde",
identifier: phone
);
var body = new KratosUpdateLoginFlowBody(method);
try
{
var result = await _frontendApi.UpdateLoginFlowAsync(flowId, body);
_logger.LogInformation("Completed OTP login flow for flow {FlowId}", flowId);
return new
{
accessToken = result.SessionToken,
expiredAt = result.Session?.ExpiresAt
};
}
catch (ApiException ex)
{
var res = JsonSerializer.Deserialize<JsonElement>(ex.ErrorContent.ToString()!);
return ex.ErrorCode switch
{
400 => res,
404 => throw new Exception("Login flow not found."),
_ => throw new Exception("Unhandled Kratos API exception: " + ex.Message),
};
}
}
public async Task<dynamic> Logout(string sessionToken)
{
var body = new KratosPerformNativeLogoutBody(sessionToken: sessionToken);
await _frontendApi.PerformNativeLogoutAsync(body);
_logger.LogInformation("Logged out session with token {SessionToken}", sessionToken);
return new { Message = "Logged out successfully." };
}
public async Task<dynamic> GetMe(string sessionToken)
{
var session = await _frontendApi.ToSessionAsync(xSessionToken: sessionToken);
_logger.LogInformation("Fetched session for identity {IdentityId}", session.Identity.Id);
return session;
}
public async Task<KratosSuccessfulNativeRegistration> PasswordRegistrationFlowAsync(string flowId, string phone)
{
var method = new KratosUpdateRegistrationFlowWithPasswordMethod(
password: "add3ae4d8ae8",
traits: new { phone = phone, identifier = phone },
method: "password"
);
var body = new KratosUpdateRegistrationFlowBody(method);
var result = await _frontendApi.UpdateRegistrationFlowAsync(flowId, body);
Console.WriteLine(JsonSerializer.Serialize(result, new JsonSerializerOptions { WriteIndented = true }));
_logger.LogInformation("Completed registration flow for {Phone}", phone);
return result;
}
}

View File

@ -1,9 +0,0 @@
//todo obsolete
using Microsoft.AspNetCore.Authentication;
namespace khmer_eid_backend.Integrations.Ory;
public sealed class OryAuthSchemeOptions : AuthenticationSchemeOptions
{
public string? BasePath { get; set; }
}

View File

@ -1,27 +0,0 @@
// // validates token & attaches user info
// public class KratosAuthMiddleware
// {
// private readonly RequestDelegate _next;
// public KratosAuthMiddleware(RequestDelegate next) => _next = next;
// public async Task InvokeAsync(HttpContext context, KratosIntegration kratos)
// {
// var cookie = context.Request.Headers["Cookie"].ToString();
// var bearer = context.Request.Headers["Authorization"].ToString().Replace("Bearer ", "");
// var session = await kratos.ValidateSessionAsync(cookie, bearer);
// if (session == null)
// {
// context.Response.StatusCode = StatusCodes.Status401Unauthorized;
// await context.Response.WriteAsync("Unauthorized");
// return;
// }
// // attach identity to HttpContext
// context.Items["user"] = session.Identity;
// await _next(context);
// }
// }

View File

@ -1,25 +0,0 @@
// Data models that map Kratos JSON responses
using System.ComponentModel.DataAnnotations;
namespace khmer_eid_backend.Models
{
// Represents user traits stored in Kratos
public class KratosTraits
{
public string Phone { get; set; } = "";
}
// Represents an identity in Kratos
public class KratosIdentity
{
public string Id { get; set; } = "";
public KratosTraits Traits { get; set; } = new();
}
// Represents a session returned by Kratos
public class KratosSession
{
public string Id { get; set; } = "";
public KratosIdentity Identity { get; set; } = new();
}
}

View File

@ -1,7 +0,0 @@
public class UserProfile
{
public int Id { get; set; }
public string KratosId { get; set; } = ""; // link to Kratos user
public string FullName { get; set; } = "";
public string NationalId { get; set; } = "";
}

View File

@ -1,19 +0,0 @@
using khmer_eid_backend.Integrations.Ory;
using Microsoft.AspNetCore.Authentication;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSingleton<KratosIntegration>();
builder.Services.AddAuthentication("Kratos")
.AddScheme<AuthenticationSchemeOptions, KratosHandler>("Kratos", _ => { });
builder.Services.AddAuthorization();
builder.Services.AddControllers();
var app = builder.Build();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
app.Run();

View File

@ -1,6 +0,0 @@
namespace khmer_eid_backend.Resources;
public class SignupResource
{
public string Phone { get; set; } = string.Empty;
}

View File

@ -1,29 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"Microsoft.AspNetCore": "Warning"
}
},
"AppSettings": {
"ApplicationName": "Khmer eID Backend - Development"
},
"Ory": {
"Kratos": {
"PublicUrl": "http://localhost:4433",
"AdminUrl": "http://localhost:4434"
}
},
"Consul": {
"Address": "http://consul:8500"
},
"Grpc": {
"GDIOnline": {
"Address": "https://gdi.dev.ekycsolutions.com"
}
},
"Kyc": {
"BaseUrl": "https://uat.ekycsolutions.com",
"EKYC_SOLUTION_PRIVATE_KEY": "d4e5840f352d448a49f296e2344cffd406535969e5b7af84b8cb867dc6ab8258"
}
}

View File

@ -1,12 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"AppSettings": {
"ApplicationName": "Khmer eID Backend"
}
}

View File

@ -1,29 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"Microsoft.AspNetCore": "Warning"
}
},
"AppSettings": {
"ApplicationName": "Khmer eID Backend - Development"
},
"Ory": {
"Kratos": {
"PublicUrl": "http://localhost:4433",
"AdminUrl": "http://localhost:4434"
}
},
"Consul": {
"Address": "http://consul:8500"
},
"Grpc": {
"GDIOnline": {
"Address": "https://gdi.dev.ekycsolutions.com"
}
},
"Kyc": {
"BaseUrl": "https://uat.ekycsolutions.com",
"EKYC_SOLUTION_PRIVATE_KEY": "d4e5840f352d448a49f296e2344cffd406535969e5b7af84b8cb867dc6ab8258"
}
}

View File

@ -1,458 +0,0 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v9.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v9.0": {
"khmer_eid_backend/1.0.0": {
"dependencies": {
"Consul": "1.7.14.9",
"Microsoft.AspNetCore.OpenApi": "9.0.9",
"Microsoft.Extensions.Http": "9.0.9",
"Ory.Kratos.Client": "1.3.8"
},
"runtime": {
"khmer_eid_backend.dll": {}
}
},
"Consul/1.7.14.9": {
"dependencies": {
"Microsoft.CSharp": "4.7.0",
"Newtonsoft.Json": "13.0.3"
},
"runtime": {
"lib/netstandard2.0/Consul.dll": {
"assemblyVersion": "1.7.14.9",
"fileVersion": "1.7.14.9"
}
}
},
"JsonSubTypes/2.0.1": {
"dependencies": {
"Newtonsoft.Json": "13.0.3"
},
"runtime": {
"lib/netstandard2.0/JsonSubTypes.dll": {
"assemblyVersion": "2.0.1.0",
"fileVersion": "2.0.1.0"
}
}
},
"Microsoft.AspNetCore.OpenApi/9.0.9": {
"dependencies": {
"Microsoft.OpenApi": "1.6.17"
},
"runtime": {
"lib/net9.0/Microsoft.AspNetCore.OpenApi.dll": {
"assemblyVersion": "9.0.9.0",
"fileVersion": "9.0.925.42003"
}
}
},
"Microsoft.CSharp/4.7.0": {},
"Microsoft.Extensions.Configuration/9.0.9": {
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "9.0.9",
"Microsoft.Extensions.Primitives": "9.0.9"
},
"runtime": {
"lib/net9.0/Microsoft.Extensions.Configuration.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.925.41916"
}
}
},
"Microsoft.Extensions.Configuration.Abstractions/9.0.9": {
"dependencies": {
"Microsoft.Extensions.Primitives": "9.0.9"
},
"runtime": {
"lib/net9.0/Microsoft.Extensions.Configuration.Abstractions.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.925.41916"
}
}
},
"Microsoft.Extensions.Configuration.Binder/9.0.9": {
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "9.0.9"
},
"runtime": {
"lib/net9.0/Microsoft.Extensions.Configuration.Binder.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.925.41916"
}
}
},
"Microsoft.Extensions.DependencyInjection/9.0.9": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.9"
},
"runtime": {
"lib/net9.0/Microsoft.Extensions.DependencyInjection.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.925.41916"
}
}
},
"Microsoft.Extensions.DependencyInjection.Abstractions/9.0.9": {
"runtime": {
"lib/net9.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.925.41916"
}
}
},
"Microsoft.Extensions.Diagnostics/9.0.9": {
"dependencies": {
"Microsoft.Extensions.Configuration": "9.0.9",
"Microsoft.Extensions.Diagnostics.Abstractions": "9.0.9",
"Microsoft.Extensions.Options.ConfigurationExtensions": "9.0.9"
},
"runtime": {
"lib/net9.0/Microsoft.Extensions.Diagnostics.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.925.41916"
}
}
},
"Microsoft.Extensions.Diagnostics.Abstractions/9.0.9": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.9",
"Microsoft.Extensions.Options": "9.0.9"
},
"runtime": {
"lib/net9.0/Microsoft.Extensions.Diagnostics.Abstractions.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.925.41916"
}
}
},
"Microsoft.Extensions.Http/9.0.9": {
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "9.0.9",
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.9",
"Microsoft.Extensions.Diagnostics": "9.0.9",
"Microsoft.Extensions.Logging": "9.0.9",
"Microsoft.Extensions.Logging.Abstractions": "9.0.9",
"Microsoft.Extensions.Options": "9.0.9"
},
"runtime": {
"lib/net9.0/Microsoft.Extensions.Http.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.925.41916"
}
}
},
"Microsoft.Extensions.Logging/9.0.9": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection": "9.0.9",
"Microsoft.Extensions.Logging.Abstractions": "9.0.9",
"Microsoft.Extensions.Options": "9.0.9"
},
"runtime": {
"lib/net9.0/Microsoft.Extensions.Logging.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.925.41916"
}
}
},
"Microsoft.Extensions.Logging.Abstractions/9.0.9": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.9"
},
"runtime": {
"lib/net9.0/Microsoft.Extensions.Logging.Abstractions.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.925.41916"
}
}
},
"Microsoft.Extensions.Options/9.0.9": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.9",
"Microsoft.Extensions.Primitives": "9.0.9"
},
"runtime": {
"lib/net9.0/Microsoft.Extensions.Options.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.925.41916"
}
}
},
"Microsoft.Extensions.Options.ConfigurationExtensions/9.0.9": {
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "9.0.9",
"Microsoft.Extensions.Configuration.Binder": "9.0.9",
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.9",
"Microsoft.Extensions.Options": "9.0.9",
"Microsoft.Extensions.Primitives": "9.0.9"
},
"runtime": {
"lib/net9.0/Microsoft.Extensions.Options.ConfigurationExtensions.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.925.41916"
}
}
},
"Microsoft.Extensions.Primitives/9.0.9": {
"runtime": {
"lib/net9.0/Microsoft.Extensions.Primitives.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.925.41916"
}
}
},
"Microsoft.OpenApi/1.6.17": {
"runtime": {
"lib/netstandard2.0/Microsoft.OpenApi.dll": {
"assemblyVersion": "1.6.17.0",
"fileVersion": "1.6.17.0"
}
}
},
"Newtonsoft.Json/13.0.3": {
"runtime": {
"lib/net6.0/Newtonsoft.Json.dll": {
"assemblyVersion": "13.0.0.0",
"fileVersion": "13.0.3.27908"
}
}
},
"Ory.Kratos.Client/1.3.8": {
"dependencies": {
"JsonSubTypes": "2.0.1",
"Newtonsoft.Json": "13.0.3",
"Polly": "8.1.0",
"RestSharp": "110.2.0"
},
"runtime": {
"lib/net6.0/Ory.Kratos.Client.dll": {
"assemblyVersion": "0.0.0.0",
"fileVersion": "0.0.0.0"
}
}
},
"Polly/8.1.0": {
"dependencies": {
"Polly.Core": "8.1.0"
},
"runtime": {
"lib/net6.0/Polly.dll": {
"assemblyVersion": "8.0.0.0",
"fileVersion": "8.1.0.2599"
}
}
},
"Polly.Core/8.1.0": {
"runtime": {
"lib/net6.0/Polly.Core.dll": {
"assemblyVersion": "8.0.0.0",
"fileVersion": "8.1.0.2599"
}
}
},
"RestSharp/110.2.0": {
"dependencies": {
"System.Text.Json": "7.0.2"
},
"runtime": {
"lib/net7.0/RestSharp.dll": {
"assemblyVersion": "110.2.0.0",
"fileVersion": "110.2.0.0"
}
}
},
"System.Text.Encodings.Web/7.0.0": {},
"System.Text.Json/7.0.2": {
"dependencies": {
"System.Text.Encodings.Web": "7.0.0"
}
}
}
},
"libraries": {
"khmer_eid_backend/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Consul/1.7.14.9": {
"type": "package",
"serviceable": true,
"sha512": "sha512-PZD63GVWmIb5KcJL5NP5KZVAMREKBTL5mj9ra4Nm2vZeVjPlTkbFfLHxinEIB7BRzjyh/5V3P5RjrfJI52nocw==",
"path": "consul/1.7.14.9",
"hashPath": "consul.1.7.14.9.nupkg.sha512"
},
"JsonSubTypes/2.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-1Po+Ypf0SjCeEKx5+C89Nb5OgTcqNvfS3uTI46MUM+KEp6Rq/M0h+vVsTUt/6DFRwZMTpsAJM4yJrZmEObVANA==",
"path": "jsonsubtypes/2.0.1",
"hashPath": "jsonsubtypes.2.0.1.nupkg.sha512"
},
"Microsoft.AspNetCore.OpenApi/9.0.9": {
"type": "package",
"serviceable": true,
"sha512": "sha512-3Sina0gS/CTYt9XG6DUFPdXOmJui7e551U0kO2bIiDk3vZ2sctxxenN+cE1a5CrUpjIVZfZr32neWYYRO+Piaw==",
"path": "microsoft.aspnetcore.openapi/9.0.9",
"hashPath": "microsoft.aspnetcore.openapi.9.0.9.nupkg.sha512"
},
"Microsoft.CSharp/4.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==",
"path": "microsoft.csharp/4.7.0",
"hashPath": "microsoft.csharp.4.7.0.nupkg.sha512"
},
"Microsoft.Extensions.Configuration/9.0.9": {
"type": "package",
"serviceable": true,
"sha512": "sha512-w87wF/90/VI0ZQBhf4rbMEeyEy0vi2WKjFmACsNAKNaorY+ZlVz7ddyXkbADvaWouMKffNmR0yQOGcrvSSvKGg==",
"path": "microsoft.extensions.configuration/9.0.9",
"hashPath": "microsoft.extensions.configuration.9.0.9.nupkg.sha512"
},
"Microsoft.Extensions.Configuration.Abstractions/9.0.9": {
"type": "package",
"serviceable": true,
"sha512": "sha512-p5RKAY9POvs3axwA/AQRuJeM8AHuE8h4qbP1NxQeGm0ep46aXz1oCLAp/oOYxX1GsjStgdhHrN3XXLLXr0+b3w==",
"path": "microsoft.extensions.configuration.abstractions/9.0.9",
"hashPath": "microsoft.extensions.configuration.abstractions.9.0.9.nupkg.sha512"
},
"Microsoft.Extensions.Configuration.Binder/9.0.9": {
"type": "package",
"serviceable": true,
"sha512": "sha512-6SIp/6Bngk4jm2W36JekZbiIbFPdE/eMUtrJEqIqHGpd1zar3jvgnwxnpWQfzUiGrkyY8q8s6V82zkkEZozghA==",
"path": "microsoft.extensions.configuration.binder/9.0.9",
"hashPath": "microsoft.extensions.configuration.binder.9.0.9.nupkg.sha512"
},
"Microsoft.Extensions.DependencyInjection/9.0.9": {
"type": "package",
"serviceable": true,
"sha512": "sha512-zQV2WOSP+3z1EuK91ULxfGgo2Y75bTRnmJHp08+w/YXAyekZutX/qCd88/HOMNh35MDW9mJJJxPpMPS+1Rww8A==",
"path": "microsoft.extensions.dependencyinjection/9.0.9",
"hashPath": "microsoft.extensions.dependencyinjection.9.0.9.nupkg.sha512"
},
"Microsoft.Extensions.DependencyInjection.Abstractions/9.0.9": {
"type": "package",
"serviceable": true,
"sha512": "sha512-/hymojfWbE9AlDOa0mczR44m00Jj+T3+HZO0ZnVTI032fVycI0ZbNOVFP6kqZMcXiLSYXzR2ilcwaRi6dzeGyA==",
"path": "microsoft.extensions.dependencyinjection.abstractions/9.0.9",
"hashPath": "microsoft.extensions.dependencyinjection.abstractions.9.0.9.nupkg.sha512"
},
"Microsoft.Extensions.Diagnostics/9.0.9": {
"type": "package",
"serviceable": true,
"sha512": "sha512-gtzl9SD6CvFYOb92qEF41Z9rICzYniM342TWbbJwN3eLS6a5fCLFvO1pQGtpMSnP3h1zHXupMEeKSA9musWYCQ==",
"path": "microsoft.extensions.diagnostics/9.0.9",
"hashPath": "microsoft.extensions.diagnostics.9.0.9.nupkg.sha512"
},
"Microsoft.Extensions.Diagnostics.Abstractions/9.0.9": {
"type": "package",
"serviceable": true,
"sha512": "sha512-YHGmxccrVZ2Ar3eI+/NdbOHkd1/HzrHvmQ5yBsp0Gl7jTyBe6qcXNYjUt9v9JIO+Z14la44+YYEe63JSqs1fYg==",
"path": "microsoft.extensions.diagnostics.abstractions/9.0.9",
"hashPath": "microsoft.extensions.diagnostics.abstractions.9.0.9.nupkg.sha512"
},
"Microsoft.Extensions.Http/9.0.9": {
"type": "package",
"serviceable": true,
"sha512": "sha512-dTmh5Rj4/WpirsN1PDs8YhyaodgtzxWqPKaT+B3Zn72uHKLJOuxIt06HTea126eEDWHYSLNN61I4snw7PuerFg==",
"path": "microsoft.extensions.http/9.0.9",
"hashPath": "microsoft.extensions.http.9.0.9.nupkg.sha512"
},
"Microsoft.Extensions.Logging/9.0.9": {
"type": "package",
"serviceable": true,
"sha512": "sha512-MaCB0Y9hNDs4YLu3HCJbo199WnJT8xSgajG1JYGANz9FkseQ5f3v/llu3HxLI6mjDlu7pa7ps9BLPWjKzsAAzQ==",
"path": "microsoft.extensions.logging/9.0.9",
"hashPath": "microsoft.extensions.logging.9.0.9.nupkg.sha512"
},
"Microsoft.Extensions.Logging.Abstractions/9.0.9": {
"type": "package",
"serviceable": true,
"sha512": "sha512-FEgpSF+Z9StMvrsSViaybOBwR0f0ZZxDm8xV5cSOFiXN/t+ys+rwAlTd/6yG7Ld1gfppgvLcMasZry3GsI9lGA==",
"path": "microsoft.extensions.logging.abstractions/9.0.9",
"hashPath": "microsoft.extensions.logging.abstractions.9.0.9.nupkg.sha512"
},
"Microsoft.Extensions.Options/9.0.9": {
"type": "package",
"serviceable": true,
"sha512": "sha512-loxGGHE1FC2AefwPHzrjPq7X92LQm64qnU/whKfo6oWaceewPUVYQJBJs3S3E2qlWwnCpeZ+dGCPTX+5dgVAuQ==",
"path": "microsoft.extensions.options/9.0.9",
"hashPath": "microsoft.extensions.options.9.0.9.nupkg.sha512"
},
"Microsoft.Extensions.Options.ConfigurationExtensions/9.0.9": {
"type": "package",
"serviceable": true,
"sha512": "sha512-n4DCdnn2qs6V5U06Sx62FySEAZsJiJJgOzrPHDh9hPK7c2W8hEabC76F3Re3tGPjpiKa02RvB6FxZyxo8iICzg==",
"path": "microsoft.extensions.options.configurationextensions/9.0.9",
"hashPath": "microsoft.extensions.options.configurationextensions.9.0.9.nupkg.sha512"
},
"Microsoft.Extensions.Primitives/9.0.9": {
"type": "package",
"serviceable": true,
"sha512": "sha512-z4pyMePOrl733ltTowbN565PxBw1oAr8IHmIXNDiDqd22nFpYltX9KhrNC/qBWAG1/Zx5MHX+cOYhWJQYCO/iw==",
"path": "microsoft.extensions.primitives/9.0.9",
"hashPath": "microsoft.extensions.primitives.9.0.9.nupkg.sha512"
},
"Microsoft.OpenApi/1.6.17": {
"type": "package",
"serviceable": true,
"sha512": "sha512-Le+kehlmrlQfuDFUt1zZ2dVwrhFQtKREdKBo+rexOwaCoYP0/qpgT9tLxCsZjsgR5Itk1UKPcbgO+FyaNid/bA==",
"path": "microsoft.openapi/1.6.17",
"hashPath": "microsoft.openapi.1.6.17.nupkg.sha512"
},
"Newtonsoft.Json/13.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==",
"path": "newtonsoft.json/13.0.3",
"hashPath": "newtonsoft.json.13.0.3.nupkg.sha512"
},
"Ory.Kratos.Client/1.3.8": {
"type": "package",
"serviceable": true,
"sha512": "sha512-dvl9tw2w0dexSQF03APQ9bzs3cXrnTBnbzS+7TZ6Mc+e2bKgVXNHcRF4p8M2pAKNSTlT0+nFrtRmrATJ/VlVUw==",
"path": "ory.kratos.client/1.3.8",
"hashPath": "ory.kratos.client.1.3.8.nupkg.sha512"
},
"Polly/8.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-EeCJCjxX/Czm6sjnEWbeCBfogYHLcPNEL6yJT5nZzT0U78sizhTYhY2l5aXxTD+DWeVRLZtkUHqWp7ij+tvYCQ==",
"path": "polly/8.1.0",
"hashPath": "polly.8.1.0.nupkg.sha512"
},
"Polly.Core/8.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-M9Mlim+I9QNP/Hu6SuWMTUFnjQPvYViGk1IAJyvdl85zNedmos8Yzx74/xPa+TEi3uof3H1xQLwAzWebhEvEYw==",
"path": "polly.core/8.1.0",
"hashPath": "polly.core.8.1.0.nupkg.sha512"
},
"RestSharp/110.2.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-FXGw0IMcqY7yO/hzS9QrD3iNswNgb9UxJnxWmfOxmGs4kRlZWqdtBoGPLuhlbgsDzX1RFo4WKui8TGGKXWKalw==",
"path": "restsharp/110.2.0",
"hashPath": "restsharp.110.2.0.nupkg.sha512"
},
"System.Text.Encodings.Web/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-OP6umVGxc0Z0MvZQBVigj4/U31Pw72ITihDWP9WiWDm+q5aoe0GaJivsfYGq53o6dxH7DcXWiCTl7+0o2CGdmg==",
"path": "system.text.encodings.web/7.0.0",
"hashPath": "system.text.encodings.web.7.0.0.nupkg.sha512"
},
"System.Text.Json/7.0.2": {
"type": "package",
"serviceable": true,
"sha512": "sha512-/LZf/JrGyilojqwpaywb+sSz8Tew7ij4K/Sk+UW8AKfAK7KRhR6mKpKtTm06cYA7bCpGTWfYksIW+mVsdxPegQ==",
"path": "system.text.json/7.0.2",
"hashPath": "system.text.json.7.0.2.nupkg.sha512"
}
}
}

View File

@ -1,19 +0,0 @@
{
"runtimeOptions": {
"tfm": "net9.0",
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "9.0.0"
},
{
"name": "Microsoft.AspNetCore.App",
"version": "9.0.0"
}
],
"configProperties": {
"System.GC.Server": true,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}

View File

@ -1 +0,0 @@
{"Version":1,"ManifestType":"Build","Endpoints":[]}

View File

@ -1,17 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Consul" Version="1.7.14.9" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.9" />
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.9" />
<PackageReference Include="Ory.Kratos.Client" Version="1.3.8" />
<Protobuf Include="Protos\gdi_online\user.proto" GrpcServices="Client" />
</ItemGroup>
</Project>

View File

@ -1,6 +0,0 @@
@khmer_eid_backend_HostAddress = http://localhost:5103
GET {{khmer_eid_backend_HostAddress}}/weatherforecast/
Accept: application/json
###

View File

@ -1,4 +0,0 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")]

View File

@ -1 +0,0 @@
obj/Debug/net9.0/Protos/gdi_online/User.cs: Protos/gdi_online/user.proto

View File

@ -1,34 +0,0 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: Protos/gdi_online/user.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021, 8981
#region Designer generated code
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
/// <summary>Holder for reflection information generated from Protos/gdi_online/user.proto</summary>
public static partial class UserReflection {
#region Descriptor
/// <summary>File descriptor for Protos/gdi_online/user.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static UserReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"ChxQcm90b3MvZ2RpX29ubGluZS91c2VyLnByb3Rv"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, null));
}
#endregion
}
#endregion Designer generated code

View File

@ -1,22 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("khmer_eid_backend")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("khmer_eid_backend")]
[assembly: System.Reflection.AssemblyTitleAttribute("khmer_eid_backend")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@ -1 +0,0 @@
61fbb10b42c7bda158ee99212ee4786aaac8a58c9e716b0f4e4c0b8efe0cc1f9

View File

@ -1,21 +0,0 @@
is_global = true
build_property.TargetFramework = net9.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb = true
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = khmer_eid_backend
build_property.RootNamespace = khmer_eid_backend
build_property.ProjectDir = /Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.RazorLangVersion = 9.0
build_property.SupportLocalizedComponentNames =
build_property.GenerateRazorMetadataSourceChecksumAttributes =
build_property.MSBuildProjectDirectory = /Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend
build_property._RazorSourceGeneratorDebug =
build_property.EffectiveAnalysisLevelStyle = 9.0
build_property.EnableCodeStyleSeverity =

View File

@ -1,17 +0,0 @@
// <auto-generated/>
global using global::Microsoft.AspNetCore.Builder;
global using global::Microsoft.AspNetCore.Hosting;
global using global::Microsoft.AspNetCore.Http;
global using global::Microsoft.AspNetCore.Routing;
global using global::Microsoft.Extensions.Configuration;
global using global::Microsoft.Extensions.DependencyInjection;
global using global::Microsoft.Extensions.Hosting;
global using global::Microsoft.Extensions.Logging;
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Net.Http.Json;
global using global::System.Threading;
global using global::System.Threading.Tasks;

View File

@ -1,16 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("Microsoft.AspNetCore.OpenApi")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@ -1 +0,0 @@
1cba3987e078add6be94db12fbe6474e14778bff75fedf54a8faf81ecb0716bd

View File

@ -1,99 +0,0 @@
/app/bin/Debug/net9.0/appsettings.Development.json
/app/bin/Debug/net9.0/appsettings.json
/app/bin/Debug/net9.0/khmer_eid_backend.staticwebassets.endpoints.json
/app/bin/Debug/net9.0/khmer_eid_backend
/app/bin/Debug/net9.0/khmer_eid_backend.deps.json
/app/bin/Debug/net9.0/khmer_eid_backend.runtimeconfig.json
/app/bin/Debug/net9.0/khmer_eid_backend.dll
/app/bin/Debug/net9.0/khmer_eid_backend.pdb
/app/bin/Debug/net9.0/Consul.dll
/app/bin/Debug/net9.0/Microsoft.AspNetCore.OpenApi.dll
/app/bin/Debug/net9.0/Microsoft.Extensions.Configuration.dll
/app/bin/Debug/net9.0/Microsoft.Extensions.Configuration.Abstractions.dll
/app/bin/Debug/net9.0/Microsoft.Extensions.Configuration.Binder.dll
/app/bin/Debug/net9.0/Microsoft.Extensions.DependencyInjection.dll
/app/bin/Debug/net9.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll
/app/bin/Debug/net9.0/Microsoft.Extensions.Diagnostics.dll
/app/bin/Debug/net9.0/Microsoft.Extensions.Diagnostics.Abstractions.dll
/app/bin/Debug/net9.0/Microsoft.Extensions.Http.dll
/app/bin/Debug/net9.0/Microsoft.Extensions.Logging.dll
/app/bin/Debug/net9.0/Microsoft.Extensions.Logging.Abstractions.dll
/app/bin/Debug/net9.0/Microsoft.Extensions.Options.dll
/app/bin/Debug/net9.0/Microsoft.Extensions.Options.ConfigurationExtensions.dll
/app/bin/Debug/net9.0/Microsoft.Extensions.Primitives.dll
/app/bin/Debug/net9.0/Microsoft.OpenApi.dll
/app/bin/Debug/net9.0/Newtonsoft.Json.dll
/app/obj/Debug/net9.0/khmer_eid_backend.csproj.AssemblyReference.cache
/app/obj/Debug/net9.0/rpswa.dswa.cache.json
/app/obj/Debug/net9.0/khmer_eid_backend.GeneratedMSBuildEditorConfig.editorconfig
/app/obj/Debug/net9.0/khmer_eid_backend.AssemblyInfoInputs.cache
/app/obj/Debug/net9.0/khmer_eid_backend.AssemblyInfo.cs
/app/obj/Debug/net9.0/khmer_eid_backend.csproj.CoreCompileInputs.cache
/app/obj/Debug/net9.0/khmer_eid_backend.MvcApplicationPartsAssemblyInfo.cs
/app/obj/Debug/net9.0/khmer_eid_backend.MvcApplicationPartsAssemblyInfo.cache
/app/obj/Debug/net9.0/rjimswa.dswa.cache.json
/app/obj/Debug/net9.0/rjsmrazor.dswa.cache.json
/app/obj/Debug/net9.0/rjsmcshtml.dswa.cache.json
/app/obj/Debug/net9.0/scopedcss/bundle/khmer_eid_backend.styles.css
/app/obj/Debug/net9.0/staticwebassets.build.json
/app/obj/Debug/net9.0/staticwebassets.build.json.cache
/app/obj/Debug/net9.0/staticwebassets.development.json
/app/obj/Debug/net9.0/staticwebassets.build.endpoints.json
/app/obj/Debug/net9.0/khmer_ei.AB393336.Up2Date
/app/obj/Debug/net9.0/khmer_eid_backend.dll
/app/obj/Debug/net9.0/refint/khmer_eid_backend.dll
/app/obj/Debug/net9.0/khmer_eid_backend.pdb
/app/obj/Debug/net9.0/khmer_eid_backend.genruntimeconfig.cache
/app/obj/Debug/net9.0/ref/khmer_eid_backend.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/appsettings.Development.json
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/appsettings.json
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/khmer_eid_backend.staticwebassets.endpoints.json
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/khmer_eid_backend
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/khmer_eid_backend.deps.json
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/khmer_eid_backend.runtimeconfig.json
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/khmer_eid_backend.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/khmer_eid_backend.pdb
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/Consul.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/Microsoft.AspNetCore.OpenApi.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/Microsoft.Extensions.Configuration.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/Microsoft.Extensions.Configuration.Abstractions.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/Microsoft.Extensions.Configuration.Binder.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/Microsoft.Extensions.DependencyInjection.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/Microsoft.Extensions.Diagnostics.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/Microsoft.Extensions.Diagnostics.Abstractions.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/Microsoft.Extensions.Http.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/Microsoft.Extensions.Logging.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/Microsoft.Extensions.Logging.Abstractions.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/Microsoft.Extensions.Options.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/Microsoft.Extensions.Options.ConfigurationExtensions.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/Microsoft.Extensions.Primitives.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/Microsoft.OpenApi.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/Newtonsoft.Json.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/khmer_eid_backend.csproj.AssemblyReference.cache
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/rpswa.dswa.cache.json
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/khmer_eid_backend.GeneratedMSBuildEditorConfig.editorconfig
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/khmer_eid_backend.AssemblyInfoInputs.cache
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/khmer_eid_backend.AssemblyInfo.cs
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/khmer_eid_backend.csproj.CoreCompileInputs.cache
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/khmer_eid_backend.MvcApplicationPartsAssemblyInfo.cs
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/khmer_eid_backend.MvcApplicationPartsAssemblyInfo.cache
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/rjimswa.dswa.cache.json
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/rjsmrazor.dswa.cache.json
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/rjsmcshtml.dswa.cache.json
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/scopedcss/bundle/khmer_eid_backend.styles.css
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/staticwebassets.build.json
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/staticwebassets.build.json.cache
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/staticwebassets.development.json
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/staticwebassets.build.endpoints.json
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/khmer_ei.AB393336.Up2Date
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/khmer_eid_backend.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/refint/khmer_eid_backend.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/khmer_eid_backend.pdb
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/khmer_eid_backend.genruntimeconfig.cache
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/Debug/net9.0/ref/khmer_eid_backend.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/JsonSubTypes.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/Ory.Kratos.Client.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/Polly.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/Polly.Core.dll
/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/bin/Debug/net9.0/RestSharp.dll

View File

@ -1 +0,0 @@
6abcebc0587d88cb0bb07ce5d3b92829d22bba60493640a78e598e12da53714d

View File

@ -1 +0,0 @@
{"GlobalPropertiesHash":"hLaq/9fRltoqAQYk//S1ccPyAsYZ/f5pweB8kt3iaSE=","FingerprintPatternsHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","PropertyOverridesHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","InputHashes":["pV1VdkIX8xZmGEw/WQxQsIphTlnQ8qx1tMqHUEJpCok=","zVrbkSKLBP11XPyaUz5bEP8Ahr\u002BYDn/dL/\u002BJgljkfSU=","DOB4g6UVOdlReaMb1lWjCTXR6q\u002BXnkk2oZ4ne\u002BG5\u002B3M=","EIwv7E7Wq2PqbqjkjrzE3aEBTVc7bxGUg/YStC4ehos=","Fxhhz3CBfv7z09juV7ju3HxhHmYUiA4vRqnjrz6WLG0="],"CachedAssets":{},"CachedCopyCandidates":{}}

View File

@ -1 +0,0 @@
{"GlobalPropertiesHash":"TLcU5CTe5YVSPBjak4sWWGX/tE/XZPWcTKK5jHN1WUM=","FingerprintPatternsHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","PropertyOverridesHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","InputHashes":["pV1VdkIX8xZmGEw/WQxQsIphTlnQ8qx1tMqHUEJpCok=","zVrbkSKLBP11XPyaUz5bEP8Ahr\u002BYDn/dL/\u002BJgljkfSU=","DOB4g6UVOdlReaMb1lWjCTXR6q\u002BXnkk2oZ4ne\u002BG5\u002B3M=","EIwv7E7Wq2PqbqjkjrzE3aEBTVc7bxGUg/YStC4ehos=","Fxhhz3CBfv7z09juV7ju3HxhHmYUiA4vRqnjrz6WLG0="],"CachedAssets":{},"CachedCopyCandidates":{}}

View File

@ -1 +0,0 @@
{"GlobalPropertiesHash":"ZdrHShuyN5m1K2F/61uspkSjyKuLAosdTDNN8ymKbjE=","FingerprintPatternsHash":"gq3WsqcKBUGTSNle7RKKyXRIwh7M8ccEqOqYvIzoM04=","PropertyOverridesHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","InputHashes":["pV1VdkIX8xZmGEw/WQxQsIphTlnQ8qx1tMqHUEJpCok=","zVrbkSKLBP11XPyaUz5bEP8Ahr\u002BYDn/dL/\u002BJgljkfSU="],"CachedAssets":{},"CachedCopyCandidates":{}}

View File

@ -1 +0,0 @@
{"Version":1,"ManifestType":"Build","Endpoints":[]}

View File

@ -1 +0,0 @@
{"Version":1,"Hash":"PkfWvTmQcVXGM6ySQWUbz9RtH3oKyUKkLYhMX3BrigU=","Source":"khmer_eid_backend","BasePath":"_content/khmer_eid_backend","Mode":"Default","ManifestType":"Build","ReferencedProjectsConfiguration":[],"DiscoveryPatterns":[],"Assets":[],"Endpoints":[]}

View File

@ -1 +0,0 @@
PkfWvTmQcVXGM6ySQWUbz9RtH3oKyUKkLYhMX3BrigU=

View File

@ -1,88 +0,0 @@
{
"format": 1,
"restore": {
"/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/khmer_eid_backend.csproj": {}
},
"projects": {
"/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/khmer_eid_backend.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/khmer_eid_backend.csproj",
"projectName": "khmer_eid_backend",
"projectPath": "/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/khmer_eid_backend.csproj",
"packagesPath": "/Users/ichen/.nuget/packages/",
"outputPath": "/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/Users/ichen/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net9.0"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net9.0": {
"targetAlias": "net9.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
},
"SdkAnalysisLevel": "9.0.300"
},
"frameworks": {
"net9.0": {
"targetAlias": "net9.0",
"dependencies": {
"Consul": {
"target": "Package",
"version": "[1.7.14.9, )"
},
"Microsoft.AspNetCore.OpenApi": {
"target": "Package",
"version": "[9.0.9, )"
},
"Microsoft.Extensions.Http": {
"target": "Package",
"version": "[9.0.9, )"
},
"Ory.Kratos.Client": {
"target": "Package",
"version": "[1.3.8, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.AspNetCore.App": {
"privateAssets": "none"
},
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/9.0.305/PortableRuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/Users/ichen/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/Users/ichen/.nuget/packages/</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.14.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="/Users/ichen/.nuget/packages/" />
</ItemGroup>
</Project>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)system.text.json/7.0.2/buildTransitive/net6.0/System.Text.Json.targets" Condition="Exists('$(NuGetPackageRoot)system.text.json/7.0.2/buildTransitive/net6.0/System.Text.Json.targets')" />
<Import Project="$(NuGetPackageRoot)microsoft.extensions.options/9.0.9/buildTransitive/net8.0/Microsoft.Extensions.Options.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.options/9.0.9/buildTransitive/net8.0/Microsoft.Extensions.Options.targets')" />
<Import Project="$(NuGetPackageRoot)microsoft.extensions.configuration.binder/9.0.9/buildTransitive/netstandard2.0/Microsoft.Extensions.Configuration.Binder.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.configuration.binder/9.0.9/buildTransitive/netstandard2.0/Microsoft.Extensions.Configuration.Binder.targets')" />
<Import Project="$(NuGetPackageRoot)microsoft.extensions.logging.abstractions/9.0.9/buildTransitive/net8.0/Microsoft.Extensions.Logging.Abstractions.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.logging.abstractions/9.0.9/buildTransitive/net8.0/Microsoft.Extensions.Logging.Abstractions.targets')" />
</ImportGroup>
</Project>

File diff suppressed because it is too large Load Diff

View File

@ -1,34 +0,0 @@
{
"version": 2,
"dgSpecHash": "R3ZV9VRLbu4=",
"success": true,
"projectFilePath": "/Users/ichen/Projects/ekyc-khmer-eID/khmer-eID-backend/khmer_eid_backend/khmer_eid_backend.csproj",
"expectedPackageFiles": [
"/Users/ichen/.nuget/packages/consul/1.7.14.9/consul.1.7.14.9.nupkg.sha512",
"/Users/ichen/.nuget/packages/jsonsubtypes/2.0.1/jsonsubtypes.2.0.1.nupkg.sha512",
"/Users/ichen/.nuget/packages/microsoft.aspnetcore.openapi/9.0.9/microsoft.aspnetcore.openapi.9.0.9.nupkg.sha512",
"/Users/ichen/.nuget/packages/microsoft.csharp/4.7.0/microsoft.csharp.4.7.0.nupkg.sha512",
"/Users/ichen/.nuget/packages/microsoft.extensions.configuration/9.0.9/microsoft.extensions.configuration.9.0.9.nupkg.sha512",
"/Users/ichen/.nuget/packages/microsoft.extensions.configuration.abstractions/9.0.9/microsoft.extensions.configuration.abstractions.9.0.9.nupkg.sha512",
"/Users/ichen/.nuget/packages/microsoft.extensions.configuration.binder/9.0.9/microsoft.extensions.configuration.binder.9.0.9.nupkg.sha512",
"/Users/ichen/.nuget/packages/microsoft.extensions.dependencyinjection/9.0.9/microsoft.extensions.dependencyinjection.9.0.9.nupkg.sha512",
"/Users/ichen/.nuget/packages/microsoft.extensions.dependencyinjection.abstractions/9.0.9/microsoft.extensions.dependencyinjection.abstractions.9.0.9.nupkg.sha512",
"/Users/ichen/.nuget/packages/microsoft.extensions.diagnostics/9.0.9/microsoft.extensions.diagnostics.9.0.9.nupkg.sha512",
"/Users/ichen/.nuget/packages/microsoft.extensions.diagnostics.abstractions/9.0.9/microsoft.extensions.diagnostics.abstractions.9.0.9.nupkg.sha512",
"/Users/ichen/.nuget/packages/microsoft.extensions.http/9.0.9/microsoft.extensions.http.9.0.9.nupkg.sha512",
"/Users/ichen/.nuget/packages/microsoft.extensions.logging/9.0.9/microsoft.extensions.logging.9.0.9.nupkg.sha512",
"/Users/ichen/.nuget/packages/microsoft.extensions.logging.abstractions/9.0.9/microsoft.extensions.logging.abstractions.9.0.9.nupkg.sha512",
"/Users/ichen/.nuget/packages/microsoft.extensions.options/9.0.9/microsoft.extensions.options.9.0.9.nupkg.sha512",
"/Users/ichen/.nuget/packages/microsoft.extensions.options.configurationextensions/9.0.9/microsoft.extensions.options.configurationextensions.9.0.9.nupkg.sha512",
"/Users/ichen/.nuget/packages/microsoft.extensions.primitives/9.0.9/microsoft.extensions.primitives.9.0.9.nupkg.sha512",
"/Users/ichen/.nuget/packages/microsoft.openapi/1.6.17/microsoft.openapi.1.6.17.nupkg.sha512",
"/Users/ichen/.nuget/packages/newtonsoft.json/13.0.3/newtonsoft.json.13.0.3.nupkg.sha512",
"/Users/ichen/.nuget/packages/ory.kratos.client/1.3.8/ory.kratos.client.1.3.8.nupkg.sha512",
"/Users/ichen/.nuget/packages/polly/8.1.0/polly.8.1.0.nupkg.sha512",
"/Users/ichen/.nuget/packages/polly.core/8.1.0/polly.core.8.1.0.nupkg.sha512",
"/Users/ichen/.nuget/packages/restsharp/110.2.0/restsharp.110.2.0.nupkg.sha512",
"/Users/ichen/.nuget/packages/system.text.encodings.web/7.0.0/system.text.encodings.web.7.0.0.nupkg.sha512",
"/Users/ichen/.nuget/packages/system.text.json/7.0.2/system.text.json.7.0.2.nupkg.sha512"
],
"logs": []
}

View File

@ -0,0 +1,62 @@
using khmereid_backend.Dtos;
using Microsoft.AspNetCore.Mvc;
using khmereid_backend.Services;
using khmereid_backend.Extensions;
using Microsoft.AspNetCore.Authorization;
namespace khmereid_backend.Controllers;
[ApiController]
[Route("auth")]
public class AuthController(AuthService _authService) : ControllerBase
{
[AllowAnonymous]
[HttpPost("request-signup-otp")]
public async Task<IActionResult> RequestSignupOtp([FromForm] SignupRequest request)
{
var response = await _authService.StartRegistrationAsync(request.Phone);
return this.ToActionResult(response);
}
[AllowAnonymous]
[HttpPost("verify-signup-otp")]
public async Task<IActionResult> VerifySignupOtp([FromForm] VerifyOtpRequest request)
{
var response = await _authService.CompleteRegistrationAsync(request.FlowId, request.Phone, request.Otp);
return this.ToActionResult(response);
}
[AllowAnonymous]
[HttpPost("request-login-otp")]
public async Task<IActionResult> RequestLoginOtp([FromForm] LoginRequest request)
{
var response = await _authService.StartLoginAsync(request.Phone);
return this.ToActionResult(response);
}
[AllowAnonymous]
[HttpPost("verify-login-otp")]
public async Task<IActionResult> VerifyLoginOtp([FromForm] VerifyOtpRequest request)
{
var response = await _authService.CompleteLoginAsync(request.FlowId, request.Phone, request.Otp);
return this.ToActionResult(response);
}
[HttpPost("logout")]
public async Task<IActionResult> Logout()
{
var token = Request.Headers.Authorization.ToString().Replace("Bearer ", "");
var response = await _authService.LogoutAsync(token);
return this.ToActionResult(response);
}
[AllowAnonymous]
[HttpGet("options")]
public IActionResult GetAuthOptions()
{
return Ok(ApiResponse<string>.Ok(null, "Not implemented."));
}
}

View File

@ -0,0 +1,17 @@
using khmereid_backend.Dtos;
using Microsoft.AspNetCore.Mvc;
using khmereid_backend.Services;
using khmereid_backend.Extensions;
namespace khmereid_backend.Controllers;
public class UserController(AuthService _authService) : ControllerBase
{
[HttpGet("me")]
public IActionResult Me()
{
var user = HttpContext.GetUser();
return this.ToActionResult(ApiResponse<UserDto>.Ok(user));
}
}

View File

@ -0,0 +1,10 @@
using khmereid_backend.Models;
using Microsoft.EntityFrameworkCore;
namespace khmereid_backend.Data
{
public class AppDbContext(DbContextOptions<AppDbContext> options) : DbContext(options)
{
public DbSet<User> Users { get; set; }
}
}

Some files were not shown because too many files have changed in this diff Show More