-
Notifications
You must be signed in to change notification settings - Fork 85
Develop #477
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
Closed
Develop #477
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| namespace Resgrid.Config | ||
| { | ||
| public static class SessionSecurityConfig | ||
| { | ||
| // Session tracking is required by the Web BFF and is safe for pre-feature | ||
| // credentials because they are adopted lazily by the validation middleware. | ||
| public static bool TrackingEnabled = true; | ||
| public static bool LegacyAdoptionEnabled = true; | ||
| public static string RequireSessionClaimForCredentialsIssuedAfterUtc = ""; | ||
| // Blank is intentionally disabled at launch. Set to an ISO-8601 UTC timestamp | ||
| // only after previewing stored DepartmentSecurityPolicy session values. | ||
| public static string DepartmentSessionPolicyEnforcementAfterUtc = ""; | ||
| public static int LastActivityWriteIntervalMinutes = 5; | ||
| public static int RevokedSessionRetentionDays = 90; | ||
| public static int PublicResetLinkLifetimeMinutes = 30; | ||
| public static int PublicResetAccountLimitPerHour = 3; | ||
| public static int PublicResetIpLimitPerHour = 10; | ||
| public static int WebBffAccessTokenLifetimeMinutes = 5; | ||
| public static int ClientMetadataMaximumLength = 256; | ||
| public static int UserAgentMaximumLength = 1024; | ||
| // Optional local JSON CIDR database. Leave blank to display location as unavailable. | ||
| public static string IpLocationDatabasePath = ""; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| namespace Resgrid.Model | ||
| { | ||
| public enum ExternalIdentityLinkMethod | ||
| { | ||
| Subject = 0, | ||
| VerifiedEmail = 1, | ||
| TrustedSamlEmail = 2, | ||
| Scim = 3, | ||
| Administrator = 4 | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
Core/Resgrid.Model/Repositories/IUserExternalIdentityLinksRepository.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| using System.Collections.Generic; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace Resgrid.Model.Repositories | ||
| { | ||
| public interface IUserExternalIdentityLinksRepository : IRepository<UserExternalIdentityLink> | ||
| { | ||
| Task<UserExternalIdentityLink> GetActiveBySubjectAsync(string departmentSsoConfigId, string externalSubject); | ||
| Task<UserExternalIdentityLink> GetActiveByUserAndConfigAsync(string userId, string departmentSsoConfigId); | ||
| Task<IReadOnlyList<UserExternalIdentityLink>> GetActiveByUserAsync(string userId); | ||
| } | ||
| } |
22 changes: 22 additions & 0 deletions
22
Core/Resgrid.Model/Repositories/IUserSessionsRepository.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace Resgrid.Model.Repositories | ||
| { | ||
| public interface IUserSessionsRepository : IRepository<UserSession> | ||
| { | ||
| Task<IReadOnlyList<UserSession>> GetActiveByUserAsync(string userId, DateTime utcNow); | ||
| Task<UserSession> GetByAuthorizationIdAsync(string authorizationId); | ||
| Task<int> TouchAsync(string sessionId, DateTime occurredOn, DateTime writeBefore, string ipAddress, | ||
| string country, string region, string city, string userAgent, CancellationToken cancellationToken); | ||
| Task<int> UpdateDepartmentAsync(string targetUserId, string sessionId, int departmentId, | ||
| CancellationToken cancellationToken); | ||
| Task<int> RevokeAsync(string targetUserId, string sessionId, string actorUserId, int reason, DateTime revokedOn, CancellationToken cancellationToken); | ||
| Task<int> RevokeOthersAsync(string userId, string currentSessionId, int reason, DateTime revokedOn, CancellationToken cancellationToken); | ||
| Task<int> RevokeAllAsync(string targetUserId, string actorUserId, int reason, DateTime revokedOn, CancellationToken cancellationToken); | ||
| Task<int> RevokeDepartmentAsync(string targetUserId, int departmentId, int reason, DateTime revokedOn, CancellationToken cancellationToken); | ||
| Task<int> PurgeInactiveBeforeAsync(DateTime historyBeforeUtc, CancellationToken cancellationToken); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Immutable configuration state in Core/Resgrid.Config/SessionSecurityConfig.cs is expressed as a mutable static field, which obscures intent and permits accidental reassignment. Mark TrackingEnabled as const, and apply the same immutability pattern to the related literals at Core/Resgrid.Config/SessionSecurityConfig.cs:8-8, :13-13, :14-14, :15-15, :16-16, :17-17, :18-18, :19-19, :20-20, Core/Resgrid.Config/OidcConfig.cs:16-16, :28-28, Core/Resgrid.Model/Identity/IdentityUser.cs:138-138, Core/Resgrid.Services/DepartmentSettingsService.cs:27-27, and Core/Resgrid.Services/LocalIpLocationProvider.cs:22-22.
Kody rule violation: Use `readonly` or `const` for Immutable Data
Prompt for LLM
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.