Skip to content

Commit

Permalink
set default audience on LexAuthUser, exclude unknown as a valid audie…
Browse files Browse the repository at this point in the history
…nce, update schema.graphql
  • Loading branch information
hahn-kev committed Oct 20, 2023
1 parent 810ad47 commit f3b6cd0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/LexBoxApi/Auth/LexAuthService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static TokenValidationParameters TokenValidationParameters(JwtOptions jwt
IssuerSigningKey = GetSigningKey(jwtOptions),
//default audience, used for cookie tokens in JwtTicketDataFormat
ValidAudience = LexboxAudience.LexboxApi.ToString(),
ValidAudiences = Enum.GetNames(typeof(LexboxAudience)),
ValidAudiences = Enum.GetNames<LexboxAudience>().Where(a => a != LexboxAudience.Unknown.ToString()),
ValidIssuer = LexboxAudience.LexboxApi.ToString(),
RequireSignedTokens = true,
RequireExpirationTime = true,
Expand Down
3 changes: 2 additions & 1 deletion backend/LexCore/Auth/LexAuthUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ public LexAuthUser(User user)

[JsonPropertyName(LexAuthConstants.IdClaimType)]
public required Guid Id { get; set; }

[JsonPropertyName(LexAuthConstants.AudienceClaimType)]
public LexboxAudience Audience { get; set; }
public LexboxAudience Audience { get; set; } = LexboxAudience.LexboxApi;

[JsonPropertyName(LexAuthConstants.EmailClaimType)]
public required string Email { get; set; }
Expand Down
2 changes: 2 additions & 0 deletions frontend/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,10 @@ enum DbErrorCode {
}

enum LexboxAudience {
UNKNOWN
LEXBOX_API
FORGOT_PASSWORD
SEND_AND_RECEIVE
}

enum ProjectMigrationStatus {
Expand Down

0 comments on commit f3b6cd0

Please sign in to comment.