Skip to content

Commit

Permalink
Merge pull request #97 from dotnetcameroon/develop
Browse files Browse the repository at this point in the history
fix: jwt variables in production pipelines
  • Loading branch information
djoufson authored Jan 3, 2025
2 parents 9a2f2b0 + 9fe9b50 commit 92e239a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/main_dotnetcameroon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ jobs:
CookiesOptions.LogoutPath: ${{ secrets.COOKIES_LOGOUTPATH}}
CookiesOptions.AccessDeniedPath: ${{ secrets.COOKIES_ACCESSDENIEDPATH}}
CookiesOptions.ExpirationInDays: ${{ secrets.COOKIES_EXPIRATIONINDAYS}}
JwtOptions.Issuer: ${{ secrets.JWT_ISSUER}}
JwtOptions.Audience: ${{ secrets.JWT_AUDIENCE}}
JwtOptions.Secret: ${{ secrets.JWT_SECRET}}
JwtOptions.ExpirationInMinutes: ${{ secrets.JWT_EXPIRATION_IN_MINUTES}}
ApplicationInsights.InstrumentationKey: ${{ secrets.AZURE_APPINSIGHTS_INSTRUMENTAL_KEY}}
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
Expand Down
8 changes: 6 additions & 2 deletions app/Api/Projects/ProjectsApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public static IEndpointRouteBuilder MapProjectsApi(this IEndpointRouteBuilder en
})
.RequireAuthorization(Policies.JwtAuthOnly);

endpoints.MapPost("/api/projects/json", async (string json, IProjectService projectService) =>
endpoints.MapPost("/api/projects/json", async (PushDataRequest request, IProjectService projectService) =>
{
var projects = JsonSerializer.Deserialize<ProjectDto[]>(json) ?? throw new InvalidOperationException("Invalid JSON");
var projects = JsonSerializer.Deserialize<ProjectDto[]>(request.Json) ?? throw new InvalidOperationException("Invalid JSON");
await projectService.RefreshAsync(projects.Select(p => new Project
{
Id = Guid.NewGuid(),
Expand All @@ -59,3 +59,7 @@ public record struct ProjectDto(
string Technologies,
string? Github,
string? Website);

public record PushDataRequest(
string Json
);
11 changes: 0 additions & 11 deletions http/LoginExternal.http
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,3 @@ Content-Type: application/json
"ApplicationId": "{{ApplicationId}}",
"ApplicationSecret": "{{ApplicationSecret}}"
}

###

### Test external login endpoint
POST http://localhost:8000/api/login/external
Content-Type: application/json

{
"ApplicationId": "ee509c54-2445-4dc8-a7f5-ea88d5528daa",
"ApplicationSecret": "exampleToken"
}

0 comments on commit 92e239a

Please sign in to comment.