* ServerProtectedData for user entity
* remove using statements
* formatting
* use data protection libs
* no async
* add data protection to ef user repo
* switch to `SetApplicationName` per ASPNET docs
* null checks
* cleanup
* value converter for EF
* new line at eof
* fix using
* remove folder ref
* restore ctor
* fix lint
* use global constant
* UseApplicationServiceProvider for integration tests
* implement constant for DatabaseFieldProtectedPrefix
* Fix EF IntegrationTest
* restore original values after protect and save
* lint fixes
* Use Constants
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* Add Sqlite as EF DB provider
Note: In-memory sqlite does not work across projects, since the migrator
only runs on the Admin project
Co-authored-by: Justin Baur <justindbaur@users.noreply.github.com>
* Include example sqlite connection string
* Add migrator assembly to sqlite connection
* Update initial migration to current schema state
* dotnet format 🤖
* Update package locks
* Respect name set in BW_SSL_KEY for cert generation (#2490)
(cherry picked from commit 2469e10110)
* [PS-2016] Add ability to change UID/GID for Bitwarden unified (#2495)
(cherry picked from commit c6fbe8cc44)
* Add SqliteMigrations project to unified Dockerfile
Co-authored-by: Justin Baur <justindbaur@users.noreply.github.com>
Co-authored-by: accolon <mail@accolon.net>
Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com>
* Changed query for device to include userId
(cherry picked from commit 5e3f6db64b)
* Refactored push registration to allow notification on multiple clients
(cherry picked from commit 75d299ae269eeb8ac272c96458815a359ea6d085)
* Linting
(cherry picked from commit f1cf54ebef2019743834f667861f9b34c1661e11)
* Fixed compile error.
* Removed class that I created when refactoring.
* Removed references to PushNotification from DeviceService tests.
* Refactored to not pass back a result on Save
* Refactored to send requestDevice to push notifications.
* Fixed whitespace.
* Added missing Noop services.
(cherry picked from commit bdad6cfadaf2779c2e672027122c95ea64e3cf0b)
* Linting.
* Refactored to put the push token back in SaveAsync.
* Removed constructor parameter.
* Added back in ClearTokenAsync to reduce risk.
* Updated tab for linting.
* [EC-394] Added ScimApplicationFactory to handle tests for Scim controllers
* [EC-394] Added Scim.IntegrationTest project with GroupsControllerTests
* [EC-394] Fixed getting Guid Id from Operation Path
* [EC-394] Added tests for GroupsController Patch action
* [EC-394] Moved tests mock data setup to ScimApplicationFactory
* [EC-394] Updated IntegrationTestCommon packages.lock.json
* [EC-394] Updated ScimApplicationFactory and GroupsControllerTests; Added UsersController Tests
* [EC-394] dotnet format
* [EC-394] Updated Identity.IntegrationTest packages.lock.json
* [EC-394] Updated Scim.IntegrationTest packages.lock.json
* [EC-394] dotnet format
* [EC-394] Reverted change on getting GUID from GetOperationPathId
* [EC-394] Fixed sending userId on Patch_AddSingleMember_Success and Patch_RemoveSingleMember_Success
* [EC-394] Updated test to send request with two operations
* [EC-394] Removed Scim dependency from IntegrationTestCommon
* [EC-394] Reverted changes to packages.lock.json. Ran dotnet format
* [EC-394] Updated Scim.IntegrationTest packages.lock.json
* [EC-394] Updated GroupsControllerTests and UsersControllerTests to implement IAsyncLifetime to cleanup database before each test
* [EC-394] Declared variables for GetList parameters
* [EC-394] Updated AssertHelper.AssertPropertyEqual to compare each item in an IEnumerable property
* [EC-394] Updated AssertHelper.AssertPropertyEqual to check if type is comparable
* [EC-394] Removed unused variable from ScimApplicationFactory
* Apply suggestions from code review
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
* [EC-394] Changed test users emails to domain example.com
* [EC-394] Restore solution file
* [EC-394] Added Scim.IntegrationTest to sln
* [EC-394] Updated integration tests to be clearer and check responses in detail
* [EC-394] Using NoopMailService to mock sending email invitations in tests
* [EC-394] Removed multiple references to the same variable ScimApplicationFactory.TestOrganizationId1
* [EC-394] Updated const variable names
* [EC-394] Using AssertPropertyEqualPredicate for IEnumerable properties
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
* Upgrade AspNetCoreRateLimiter and enable redis distributed cache for rate limiting.
- Upgrades AspNetCoreRateLimiter to 4.0.2, which required updating NewtonSoft.Json to 13.0.1.
- Replaces Microsoft.Extensions.Caching.Redis with Microsoft.Extensions.Caching.StackExchangeRedis as the original was deprecated and conflicted with the latest AspNetCoreRateLimiter
- Adds startup task to Program.cs for Api/Identity projects to support AspNetCoreRateLimiters breaking changes for seeding its stores.
- Adds a Redis connection string option to GlobalSettings
Signed-off-by: Shane Melton <smelton@bitwarden.com>
* Cleanup Redis distributed cache registration
- Add new AddDistributedCache service collection extension to add either a Memory or Redis distributed cache.
- Remove distributed cache registration from Identity service collection extension.
- Add IpRateLimitSeedStartupService.cs to run at application startup to seed the Ip rate limiting policies.
Signed-off-by: Shane Melton <smelton@bitwarden.com>
* Add caching configuration to SSO Startup.cs
Signed-off-by: Shane Melton <smelton@bitwarden.com>
* Add ProjectName as an instance name for Redis options
Signed-off-by: Shane Melton <smelton@bitwarden.com>
* Use distributed cache in CustomIpRateLimitMiddleware.cs
Signed-off-by: Shane Melton <smelton@bitwarden.com>
* Undo changes to Program.cs and launchSettings.json
* Move new service collection extensions to SharedWeb
* Upgrade Caching.StackExchangeRedis package to v6
* Cleanup and fix leftover merge conflicts
* Remove use of Newtonsoft.Json in distributed cache extensions
* Cleanup more formatting
* Fix formatting
* Fix startup issue caused by merge and fix integration test
Signed-off-by: Shane Melton <smelton@bitwarden.com>
* Linting fix
Signed-off-by: Shane Melton <smelton@bitwarden.com>
* Add api integration tests
* Add some stuff
* Make program mockable
* Work on IntegrationTests for Identity
* Formatting
* Update packages.lock.json
* Update more packages.lock.json
* Update all packages.lock.json
* Fix InMemory configuration
* Actually fix test configuration
* Fix tests for CI
* Fix event service
* Force EF EventRepository
* Add client_credentials test
* Remove Api.IntegrationTest
* Remove Api Program changes
* Cleanup
* Add more Auth-Email tests
* Run formatting
* Address some PR feedback
* Move integration stuff to it's own common project
* Ran linter
* Add shared project to test solution
* Remove sln changes
* Clean usings
* Add more coverage
* Address PR feedback