It looks like 2fa.directory has changed it's API endpoint.
According to https://2fa.directory/api/ it now uses `api.2fa.directory` instead of `2fa.directory/api`.
This PR fixes the URL's where needed.
A fix for the client side is also created.
* SG-825 - Policy_ReadByUserId stored proc now pulls back policies of disabled orgs
* SG-825 - SyncController - Always retrieve policies -- even if orgs are disabled.
* SG-825 - EF - PolicyReadByUserId - autoformat to remove whitespace and pass eslint build error
* 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>
* [EC-343] Added column 'UseCustomPermissions' to Organization table
* [EC-343] Added 'UseCustomPermissions' to Api responses
* [EC-343] Added 'UseCustomPermissions' to Admin view
* [EC-343] Add constraint to Organization table to have default UseCustomPermissions value
* [EC-343] Recreate OrganizationView to include UseCustomPermissions column
* [EC-343] Add MySql EF migrations
* [EC-343] Add Postgres EF migrations
* Revert "[EC-343] Add Postgres EF migrations"
This reverts commit 8f1654cb7d.
* [EC-343] Add Postgres migrations and script
* [EC-343] dotnet format
* [EC-343] Set 'Custom Permissions' feature as unchecked for teams plan
* [EC-343] Add CustomPermissions to plan upgrades
* [EC-343] Update CURRENT_LICENSE_FILE_VERSION
* [EC-343] Enable 'Custom Permissions' on Enterprise 2019 plan
* [EC-343] Updated migration script to include Enterprise 2019 plan
* [EC-343] Update CURRENT_LICENSE_FILE_VERSION to 10
* [EC-343] Move logic checking if Organization can use custom permissions to OrganizationService
* [EC-343] Add unit tests to validate UseCustomPermissions check
* [EC-343] Revert UseCustomPermissionsFlag migration
* [EC-343] Fix typo in OrganizationUserOrganizationDetailsViewQuery
* [EC-343] Add Postgres migrations without affecting other datetime column
* [EC-343] Create ValidateOrganizationCustomPermissionsEnabledAsync. Add more unit tests around CustomPermissions check
* [EC-343] Add curly brackets to if condition
* [EC-343] Rename unit tests
* [EC-449] Added new Enum EventSystemUser
* [EC-449] Added SystemUser property to Event model
* [EC-449] Added SQL migration to add new column 'SystemUserType' to Event
* [EC-449] EF migrations
* [EC-449] Added EventSystemUser to EventResponseModel
* [EC-449] Saving EventSystemUser.SCIM on SCIM controller actions
* [EC-449] Updated Event_Create stored procedure on Sql project
* [EC-449] Fixed SystemUser column name on Event table
* [EC-507] SCIM CQRS Refactor - Groups/Put (#2269)
* [EC-390] Added Scim.Test unit tests project
* [EC-390] Added ConflictException type. Updated BadRequestException to have parameterless constructor. Updated NotFoundException to have constructor with a message parameter
* [EC-531] Implemented CQRS for Groups Put and added unit tests
* [EC-507] Created ScimServiceCollectionExtensions
* [EC-507] Renamed AddScimCommands to AddScimGroupCommands
* [EC-507] Created ExceptionHandlerFilterAttribute on SCIM project
* [EC-507] Removed unneeded dependencies from GroupsController
* [EC-507] Update PutGroupCommand to return Group
PutGroupCommand returns Group and GroupsController creates ScimGroupResponseModel response
* [EC-507] Remove Queries/Commands folders from Scim and Scim.Tests
* [EC-507] Remove unneeded check on empty provided memberIds
* [EC-507] SCIM CQRS Refactor - Groups/GetList (#2272)
* [EC-390] Added Scim.Test unit tests project
* [EC-390] Added ConflictException type. Updated BadRequestException to have parameterless constructor. Updated NotFoundException to have constructor with a message parameter
* [EC-508] Implemented CQRS for Groups GetList and added unit tests
* [EC-507] Created ScimServiceCollectionExtensions and renamed GetGroupsListCommand to GetGroupsListQuery
* [EC-507] Renamed AddScimCommands to AddScimGroupQueries
* [EC-507] Removed unneeded dependencies from GroupsController
* [EC-507] Remove 'Queries' folder from Scim and Scim.Test
* [EC-507] Move ScimListResponseModel from GetGroupsListQuery to Scim.GroupsController
* [EC-507] Remove asserts on IGroupRepository.GetManyByOrganizationIdAsync from unit tests
* [EC-507] SCIM CQRS Refactor - Groups/Get (#2271)
* [EC-390] Added Scim.Test unit tests project
* [EC-390] Added ConflictException type. Updated BadRequestException to have parameterless constructor. Updated NotFoundException to have constructor with a message parameter
* [EC-507] Implemented CQRS for Groups Get and added unit tests
* [EC-507] Created ScimServiceCollectionExtensions and renamed GetGroupCommand to GetGroupQuery
* [EC-507] Renamed AddScimCommands to AddScimGroupQueries
* [EC-507] Created ExceptionHandlerFilterAttribute on SCIM project
* [EC-507] Removed unneeded dependencies from GroupsController
* [EC-507] Sorted order of methods
* [EC-507] Removed GetGroupQuery and moved logic to controller
* [EC-507] Remove 'Queries' folder from Scim and Scim.Test
* [EC-507] SCIM CQRS Refactor - Groups/Patch (#2268)
* [EC-390] Added Scim.Test unit tests project
* [EC-390] Added ConflictException type. Updated BadRequestException to have parameterless constructor. Updated NotFoundException to have constructor with a message parameter
* [EC-532] Implemented CQRS for Groups Patch and added unit tests
* [EC-507] Created ScimServiceCollectionExtensions
* [EC-507] Renamed AddScimCommands to AddScimGroupCommands
* [EC-507] Created ExceptionHandlerFilterAttribute on SCIM project
* [EC-507] Removed unneeded dependencies from GroupsController
* [EC-507] Remove Queries/Commands folders from Scim and Scim.Tests
* [EC-507] Assert group.Name after saving. Assert userIds saved.
* [EC-508] SCIM CQRS Refactor - Users/Delete (#2261)
* [EC-390] Added Scim.Test unit tests project
* [EC-390] Added ConflictException type. Updated BadRequestException to have parameterless constructor. Updated NotFoundException to have constructor with a message parameter
* [EC-539] Implemented CQRS for Users Delete and added unit tests
* [EC-508] Created ScimServiceCollectionExtensions
* [EC-508] Created ExceptionHandlerFilterAttribute on SCIM project
* [EC-508] Removed unneeded model from DeleteUserCommand. Removed unneeded dependencies from UsersController
* [EC-508] Removed Bit.Scim.Models dependency from DeleteUserCommandTests
* [EC-508] Deleted 'DeleteUserCommand' from SCIM; Created commands on Core 'DeleteOrganizationUserCommand', 'PushDeleteUserRegistrationOrganizationCommand' and 'OrganizationHasConfirmedOwnersExceptQuery'
* [EC-508] Changed DeleteOrganizationUserCommand back to using IOrganizationService
* [EC-508] Fixed DeleteOrganizationUserCommand unit tests
* [EC-508] Remove unneeded obsolete comments. Update DeleteUserAsync Obsolete comment with ticket reference
* [EC-508] Move DeleteOrganizationUserCommand to OrganizationFeatures folder
* [EC-508] SCIM CQRS Refactor - Users/Post (#2264)
* [EC-390] Added Scim.Test unit tests project
* [EC-390] Added ConflictException type. Updated BadRequestException to have parameterless constructor. Updated NotFoundException to have constructor with a message parameter
* [EC-536] Implemented CQRS for Users Post and added unit tests
* [EC-508] Created ScimServiceCollectionExtensions
* [EC-508] Renamed AddScimCommands to AddScimUserCommands
* [EC-508] Created ExceptionHandlerFilterAttribute on SCIM project
* [EC-508] Catching NotFoundException on ExceptionHandlerFilter
* [EC-508] Remove Queries/Commands folders from Scim and Scim.Tests
* [EC-508] SCIM CQRS Refactor - Users/Patch (#2262)
* [EC-390] Added Scim.Test unit tests project
* [EC-390] Added ConflictException type. Updated BadRequestException to have parameterless constructor. Updated NotFoundException to have constructor with a message parameter
* [EC-538] Implemented CQRS for Users Patch and added unit tests
* [EC-508] Added ScimServiceCollectionExtensions
* [EC-508] Removed HandleActiveOperationAsync method from UsersController
* [EC-508] Renamed AddScimCommands to AddScimUserCommands
* [EC-508] Created ExceptionHandlerFilterAttribute on SCIM project
* [EC-508] Removed unneeded dependencies from UsersController
* [EC-508] Remove 'Query' folder from Scim and Scim.Test
* [EC-507] SCIM CQRS Refactor - Groups/Post (#2270)
* [EC-390] Added Scim.Test unit tests project
* [EC-390] Added ConflictException type. Updated BadRequestException to have parameterless constructor. Updated NotFoundException to have constructor with a message parameter
* [EC-530] Implemented CQRS for Groups Post and added unit tests
* [EC-507] Created ScimServiceCollectionExtensions
* [EC-507] Renamed AddScimCommands to AddScimGroupCommands
* [EC-507] Created ExceptionHandlerFilterAttribute on SCIM project
* [EC-507] Removed unneeded dependencies from GroupsController
* [EC-507] Remove Queries/Commands folders from Scim and Scim.Test
* [EC-507] Remove unneeded skipIfEmpty argument. Updated unit test to check provided userIds
* [EC-507] Remove UpdateGroupMembersAsync from GroupsController
* [EC-508] SCIM CQRS Refactor - Users/GetList (#2265)
* [EC-390] Added Scim.Test unit tests project
* [EC-390] Added ConflictException type. Updated BadRequestException to have parameterless constructor. Updated NotFoundException to have constructor with a message parameter
* [EC-535] Implemented CQRS for Users GetList and added unit tests
* [EC-508] Created ScimServiceCollectionExtensions and renamed GetUsersListCommand to GetUsersListQuery
* [EC-508] Renamed AddScimCommands to AddScimUserQueries
* [EC-508] Removed unneeded IUserRepository and IOptions<ScimSettings> from UsersController
* [EC-508] Sorted UsersController properties and dependencies
* [EC-508] Remove 'Queries' folder from Scim and Scim.Test
* [EC-508] Move ScimListResponseModel creation to Scim.UsersController
* [EC-508] Move ScimUserResponseModel creation to Scim.UsersController
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
* [EC-507] SCIM CQRS Refactor - Groups/Delete (#2267)
* [EC-390] Added Scim.Test unit tests project
* [EC-390] Added ConflictException type. Updated BadRequestException to have parameterless constructor. Updated NotFoundException to have constructor with a message parameter
* [EC-533] Implemented CQRS for Groups Delete and added unit tests
* [EC-507] Created ScimServiceCollectionExtensions
* [EC-507] Renamed AddScimCommands to AddScimGroupCommands
* [EC-507] Created ExceptionHandlerFilterAttribute on SCIM project
* [EC-507] Removed unneeded dependencies from GroupsController
* [EC-507] Move DeleteGroupCommand to OrganizationFeatures/OrganizationUsers
* [EC-507] Remove IGetUserQuery and move logic to UsersController. Remove unused references.
* [EC-449] Add overloads for EventService and GroupService methods that accept EventSystemUser as an argument
* [EC-507] Move IDeleteGroupCommand to Groups folder
* [EC-449] Add method overloads in IOrganizationService without EventSystemUser
* [EC-449] Add RevokeUserAsync overload without EventSystemUser
* [EC-449] Reverted OrganizationUsersController to not pass EventSystemUser argument
* [EC-449] Uncomment assertion in GroupServiceTests
* [EC-449] Update method overloads to not have nullable EventSystemUser
* [EC-449] Add unit tests around events that can store EventSystemUser
* [EC-449] Deleted private method GroupService.GroupRepositoryDeleteAsync
* [EC-449] Move Event log call to public DeleteUserAsync methods
* [EC-449] Move call to EventService log to public OrganizationService.InviteUsersAsync methods
* [EC-449] Move EventService call to public OrganizationService.DeleteUserAsync methods
* [EC-449] Move EventService call to OrganizationService.RevokeUserAsync methods
* [EC-449] Move EventService call to OrganizationService.RestoreUserAsync methods
* [EC-449] Add missing comma in SQL script for new SystemUser column on the Event table
* [EC-449] Remove Autofixture hack from OrganizationServiceTests
* [EC-449] Remove invitingUser param when methods expect an EventSystemUser param
* [EC-449] Move DeleteUserAsync validation to private method
* [EC-449] Move revokingUserId from RevokeUserAsync private method
* [EC-449] Move restoringUserId to RestoreUserAsync public method
* [EC-449] Set up OrganizationServiceTest Restore and Revoke tests on a single method
* [EC-449] SaveUsersSendInvitesAsync to return both OrganizationUsers and Events list
* [EC-449] Undo unintended change on CipherRepository
* [EC-449] Add SystemUser value to EventTableEntity
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
* Added migrations for sqlserver and mysql
* Added migrations for postgres
* renamed mysql migration script to make naming uniform
* introduced approved field to the update auth request controller;This change would keep track of denied passwordless requests
* Recreated the authRequestView, introduced the approved field to the create procedure and updated the response model
* Formatted code
* fixed incorrect syntax in the AuthRequest_Create.sql SP
* PS-976 - update PutPartial endpoint to return cipher info, update Cipher_Move sproc to allow users to update a cipher's folder even if they don't have edit permissions
* PS-976- fix formatting errors
* PS-976 - per cr feedback updated EF query to match cipher_move sproc update, and updated cipher tests to align with existing tests
* [SG-549] Commit Initial AuthRequest Repository (#2174)
* Model Passwordless
* Scaffold database for Passwordless
* Implement SQL Repository
* [SG-167] Base Passwordless API (#2185)
* Implement Passwordless notifications
* Implement Controller
* Add documentation to BaseRequestValidator
* Register AuthRequestRepo
* Remove ExpirationDate from the AuthRequest table
* [SG-407] Create job to delete expired requests (#2187)
* chore: init
* remove exp date
* fix: log name
* [SG-167] Added fingerprint phrase to response model. (#2233)
* Remove FailedLoginAttempt logic
* Block unknown devices
* Add EF Support for passwordless
* Got SignalR working for responses
* Added delete job method to EF repo
* Implement a GetMany API endpoint for AuthRequests
* Ran dotnet format
* Fix a merge issues
* Redated migration scripts
* tried sorting sqlproj
* Remove FailedLoginAttempts from SQL
* Groom Postgres script
* Remove extra commas from migration script
* Correct isSpent()
* [SG-167] Adde identity validation for passwordless requests. Registered IAuthRepository.
* [SG-167] Added origin of the request to response model
* Use display name for device identifier in response
* Add datetime conversions back to postgres migration script
* [SG-655] Add anonymous endpoint for checking if a device & user combo match
* [review] Consolidate error conditions
Co-authored-by: Brandon Maharaj <107377945+BrandonM-Bitwarden@users.noreply.github.com>
Co-authored-by: André Filipe da Silva Bispo <andrefsbispo@hotmail.com>
Co-authored-by: André Bispo <abispo@bitwarden.com>
* Added migration script to alter ProviderOrganizationOrganizationDetailsView to add new columns UserCount, Seats and Plan
* Modified EF query ProviderOrganizationOrganizationDetailsReadByProviderIdQuery
* Modified model to output new view columns
* Updated view to count only active users
* Filtering the organization user count by only confirmed users
* 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>
* scim project stub
* some scim models and v2 controllers
* implement some v2 scim endpoints
* fix spacing
* api key auth
* EC-261 - SCIM Org API Key and connection type config
* EC-261 - Fix lint errors/formatting
* updates for okta implementation testing
* fix var ref
* updates from testing with Okta
* implement scim context via provider parsing
* support single and list of ids for add/remove groups
* log ops not handled
* touch up scim context
* group list filtering
* EC-261 - Additional SCIM provider types
* EC-265 - UseScim flag and license update
* EC-265 - SCIM provider type of default (0)
* EC-265 - Add Scim URL and update connection validation
* EC-265 - Model validation and cleanup for SCIM keys
* implement scim org connection
* EC-265 - Ensure ServiceUrl is not persisted to DB
* EC-265 - Exclude provider type from DB if not configured
* EC-261 - EF Migrations for SCIM
* add docker builds for scim
* EC-261 - Fix failing permissions tests
* EC-261 - Fix unit tests and pgsql migrations
* Formatting fixes from linter
* EC-265 - Remove service URL from scim config
* EC-265 - Fix unit tests, removed wayward validation
* EC-265 - Require self-hosted for billing sync org conn
* EC-265 - Fix formatting issues - whitespace
* EC-261 - PR feedback and cleanup
* scim constants rename
* no scim settings right now
* update project name
* delete package lock
* update appsettings configs for scim
* use default scim provider for context
Co-authored-by: Kyle Spearrin <kyle.spearrin@gmail.com>
* PS-589 Fix 2022-05-24_00_DeviceUnknownVerification User_Update proc to remove the NULL and set the default value
* PS-589 updated stored procedures on Sql project to have UnknownDeviceVerificationEnabled with default 1 instead of NULL
* Added UnknownDeviceVerificationEnabled on User that is turned off when emergency contact takes over the account. Also added endpoints to get and update 2fa device verification settings. And Updated migrations & tests
* Applied dotnet format
* Fixed method rename call on TwoFactorController
* PS-589 Format fixes
* PS-589 changed UnknownDeviceVerificationEnabled to be non-nullable
* 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