Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: jwt variables in production pipelines #97

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
}
Loading