10000 feat: Users can now use two-factor authentication with time-based one… by jekutzsche · Pull Request #840 · iris-connect/iris-client · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: Users can now use two-factor authentication with time-based one… #840

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

Merged
merged 4 commits into from
Jun 30, 2022

Conversation

jekutzsche
Copy link
Member

…-time password (TOTP). If it is enabled, a TOTP is expected and verified by a corresponding app after the conventional login. To set up the app, the user is displayed a QR code by IRIS. It is also possible for the admin to activate this mandatorily via environment variable. If a 2FA is expected but has not yet been finally configured for a user with a successful verification, the QR code is displayed after the successful conventional login and the verification is performed.

A secret for the MFA has been added to UserAccount and a flag indicating whether the transfer of the secret was completed successfully with verification. Furthermore, the UserService was supplemented with methods for working with the secret.

The security.auth.db.mfa.option property was added to specify how the MFA should be used. Possible values are: ALWAYS, OPTIONAL_DEFAULT_TRUE, OPTIONAL_DEFAULT_FALSE, DISABLED.

The new MfAuthenticationConfigController allows querying the configuration for the MFA via the /mfa/config path. Thus the FE can be adapted accordingly.

An optional step (depending on the MFA configuration) has been added to the authentication process. If the conventional login was successful, with active MFA a token is returned which only allows access to /mfa/otp. This is used to check an OTP to complete the authentication. Only after that a general JWT is returned.

The responses to authentication requests now contain a body with the property authenticationStatus, which contains the status of the authentication and can take the following values: AUTHENTICATED, PRE_AUTHENTICATED_MFA_REQUIRED, PRE_AUTHENTICATED_ENROLLMENT_REQUIRED.

The new annotation @WithMockIrisUser has been added to create a user with authorities = "USER". This is necessary because an authority is now required for the accesses.

Refs iris-connect/iris-backlog#251

@jekutzsche jekutzsche force-pushed the feature/BL_251-2FA branch from 245b2e6 to d0fa028 Compare June 20, 2022 07:57
@jekutzsche jekutzsche force-pushed the chore/code_cleanup_in_core_package branch from 56cfc1e to 662ec3d Compare June 22, 2022 08:23
Base automatically changed from chore/code_cleanup_in_core_package to develop June 22, 2022 08:36
@jekutzsche jekutzsche force-pushed the feature/BL_251-2FA branch from d0fa028 to dda2191 Compare June 22, 2022 10:07
@github-actions
Copy link
github-actions bot commented Jun 22, 2022

Unit Test Results

360 tests   360 ✔️  3m 34s ⏱️
  58 suites      0 💤
  58 files        0

Results for commit eade808.

♻️ This comment has been updated with latest results.

Copy link
Contributor
@lucky-lusa lucky-lusa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor
@lucky-lusa lucky-lusa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

jekutzsche and others added 4 commits June 30, 2022 08:38
…-time password (TOTP). If it is enabled, a TOTP is expected and verified by a corresponding app after the conventional login. To set up the app, the user is displayed a QR code by IRIS. It is also possible for the admin to activate this mandatorily via environment variable. If a 2FA is expected but has not yet been finally configured for a user with a successful verification, the QR code is displayed after the successful conventional login and the verification is performed.

A secret for the MFA has been added to `UserAccount` and a flag indicating whether the transfer of the secret was completed successfully with verification. Furthermore, the `UserService` was supplemented with methods for working with the secret.

The `security.auth.db.mfa.option` property was added to specify how the MFA should be used. Possible values are: `ALWAYS, OPTIONAL_DEFAULT_TRUE, OPTIONAL_DEFAULT_FALSE, DISABLED`.

The new `MfAuthenticationConfigController` allows querying the configuration for the MFA via the `/mfa/config` path. Thus the FE can be adapted accordingly.

An optional step (depending on the MFA configuration) has been added to the authentication process. If the conventional login was successful, with active MFA a token is returned which only allows access to `/mfa/otp`. This is used to check an OTP to complete the authentication. Only after that a general JWT is returned.

The responses to authentication requests now contain a body with the property `authenticationStatus`, which contains the status of the authentication and can take the following values: `AUTHENTICATED, PRE_AUTHENTICATED_MFA_REQUIRED, PRE_AUTHENTICATED_ENROLLMENT_REQUIRED`.

The new annotation `@WithMockIrisUser` has been added to create a user with `authorities = "USER"`. This is necessary because an authority is now required for the accesses.

Refs iris-connect/iris-backlog#251
@mad-nuts mad-nuts force-pushed the feature/BL_251-2FA branch from 15b3995 to eade808 Compare June 30, 2022 07:11
@jekutzsche jekutzsche merged commit 03b915c into develop Jun 30, 2022
@jekutzsche jekutzsche deleted the feature/BL_251-2FA branch June 30, 2022 07:30
jekutzsche pushed a commit that referenced this pull request Jun 30, 2022
# [1.6.0-rc.2](v1.6.0-rc.1...v1.6.0-rc.2) (2022-06-30)

### Bug Fixes

* Changes NGINX Content-Security-Policy configuration to allow data urls as image src and adds `data:` to the forbidden keywords. ([cedf240](cedf240)), closes [#862](#862)
* Fixes an occasional `ConstraintViolationException` that can only be caused by parallel processing of multiple requests from the same IP. ([71c1c98](71c1c98)), closes [#828](#828)
* HTTP status code is now set correctly for validation errors with JSON-RPC (400). Related to this, there is now a central place to handle exceptions with JSON-RPC and to configure the correct HTTP status code. ([e0b98f7](e0b98f7)), closes [#827](#827)
* When checking incoming and entered data for possible attacks, case is now ignored for keywords. ([a378e58](a378e58)), closes [#864](#864)

### Features

* In the `.env` (see `.env.sample`) now the configuration for the mail dispatch can be done. With this it is now possible to send notifications when new data has been transferred to the IRIS client (at the moment implemented for the data of an event). ([4310bd0](4310bd0)), closes [#557](#557) [#858](#858)
* Users can now use two-factor authentication with time-based one-time password (TOTP). If it is enabled, a TOTP is expected and verified by a corresponding app after the conventional login. To set up the app, the user is displayed a QR code by IRIS. It is also possible for the admin to activate this mandatorily via environment variable. If a 2FA is expected but has not yet been finally configured for a user with a successful verification, the QR code is displayed after the successful conventional login and the verification is performed. ([03b915c](03b915c)), closes [iris-connect/iris-backlog#251](https://github.com/iris-connect/iris-backlog/issues/251) [#840](#840)
@jekutzsche
Copy link
Member Author

🎉 This PR is included in version 1.6.0-rc.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

jekutzsche pushed a commit that referenced this pull request Jun 30, 2022
# [1.6.0](v1.5.1...v1.6.0) (2022-06-30)

### Bug Fixes

* add support for multi-column sort query parameters (fixes broken table sort of iris-message list) ([9daf6a1](9daf6a1)), closes [#801](#801)
* Changes NGINX Content-Security-Policy configuration to allow data urls as image src and adds `data:` to the forbidden keywords. ([cedf240](cedf240)), closes [#862](#862)
* **Dependencies:** Updates version of jackson-databind to fix the vulnerability: avd.aquasec.com/nvd/cve-2020-36518 ([84a4b04](84a4b04))
* **Deps:** updates Spring Boot to 2.6.6 to fix the vulnerability avd.aquasec.com/nvd/cve-2022-22965 ([46a50b5](46a50b5))
* fix dependabot security alert and update multiple npm dependencies ([7b7
8000
1e64](7b71e64)), closes [#729](#729)
* fix e2e tests by correcting the spec order ([53fd088](53fd088)), closes [#764](#764)
* Fixes a validation error when changing user data of admins. This could lead to an admin not being able to change their data under certain circumstances (only admin and role not transferred with). ([61f6bc3](61f6bc3)), closes [#703](#703)
* Fixes an occasional `ConstraintViolationException` that can only be caused by parallel processing of multiple requests from the same IP. ([71c1c98](71c1c98)), closes [#828](#828)
* ga-gotham config tls communication between internal eps ([4b6cf41](4b6cf41))
* HTTP status code is now set correctly for validation errors with JSON-RPC (400). Related to this, there is now a central place to handle exceptions with JSON-RPC and to configure the correct HTTP status code. ([e0b98f7](e0b98f7)), closes [#827](#827)
* removed line breaks at the end of certificates. ([64104a0](64104a0))
* When checking incoming and entered data for possible attacks, case is now ignored for keywords. ([a378e58](a378e58)), closes [#864](#864)

### Features

* For JSON-RPC calls (calls from EPS), the client name submitted by EPS is now used as user (if available). Thus, the metadata of records created via JSON-RPC now also contain a user as creator and it is easier to see by whom the data was created. ([71ff56f](71ff56f)), closes [#826](#826)
* In the `.env` (see `.env.sample`) now the configuration for the mail dispatch can be done. With this it is now possible to send notifications when new data has been transferred to the IRIS client (at the moment implemented for the data of an event). ([4310bd0](4310bd0)), closes [#557](#557) [#858](#858)
* **Messages:** Messages can now be used to exchange guests of events between health departments. This makes it possible to transmit the guests received through a data request to the responsible department. The data can be transferred directly from the event overview to a message or can also be added to a message as an attachment. This is the beginning, more data types will follow. ([9c3c8cd](9c3c8cd)), closes [#640](#640)
* **Messages:** Messages can now be used to exchange vaccination reports between health departments. This makes it possible to transmit received records to the appropriate department through a data transfer. The data can be transferred directly from the vaccination report overview to a message or can also be added as an attachment to a message. ([64636ba](64636ba)), closes [#762](#762)
* Old messages are deleted after a configurable time (default is after 180 days) with all associated data. ([d768632](d768632)), closes [#773](#773)
* The authentication tokens (JWT) now retain their validity beyond the restart of the IRIS client. This means that, ideally, users notice only little of a restart of the application. ([2442685](2442685)), closes [#804](#804)
* The client backend now also supports the use of a refresh token, which can be used to extend the short validity of the authentication. This makes it more convenient to use, especially in conjunction with a two-factor authentication. ([b20ed86](b20ed86)), closes [#803](#803)
* The client is now a bit more secure against attacks and authentication token (JWT) stealing. For this, the JWT is now transferred and processed in HTTP-only cookies. In this context, XSRF protection with XSRF-TOKEN cookies has also been enabled. ([ae25da8](ae25da8)), closes [#802](#802)
* Users are no longer deleted immediately, but marked as deleted. The marked users can no longer be used and are no longer displayed. However, the data is still available, for example, for working with the audit logs. After all references to the users are deleted according to the respective deadline or after a specified time, the users are finally anonymized. Procedure and time periods are configurable. ([a913eaf](a913eaf)), closes [iris-connect/iris-backlog#235](https://github.com/iris-connect/iris-backlog/issues/235) [#761](#761)
* Users can be marked as locked. This makes it possible to temporarily lock users when they are absent. The locked users are not deleted, they are still available in the overview, but cannot be used for a login. ([68d55ec](68d55ec)), closes [#775](#775)
* Users can now use two-factor authentication with time-based one-time password (TOTP). If it is enabled, a TOTP is expected and verified by a corresponding app after the conventional login. To set up the app, the user is displayed a QR code by IRIS. It is also possible for the admin to activate this mandatorily via environment variable. If a 2FA is expected but has not yet been finally configured for a user with a successful verification, the QR code is displayed after the successful conventional login and the verification is performed. ([03b915c](03b915c)), closes [iris-connect/iris-backlog#251](https://github.com/iris-connect/iris-backlog/issues/251) [#840](#840)

### Reverts

* Revert "chore(Deps): removes unnecessary Postgres version (spring declares the same) and improves jackson dependency" ([90bb5fa](90bb5fa))
@jekutzsche
Copy link
Member Author

🎉 This PR is included in version 1.6.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0