‏ ‏ ‎ ‏ ‏ ‎

1. Guides on Quarkus Portal

2. Sicherheitskonzepte in Quarkus

2.1. Credentials

Login credentials authenticate a user when logging into an online account over the Internet. At the very least, the credentials are username and password; however, a physical or human biometric element may also be required.

2.2. Authentifizierung und Autorisierung

  • Grundsätzlich muss man sich zunächst authentifizieren → Wer bin ich?

  • Anschließend ist man autorisiert, um auf Ressourcen zuzugreifen → Was darf ich?

Authentifizierung und Autorisierung mit ContainerRequestFilter

"open doc"

2.3. Authentifizierungsmechanismen

Quarkus kennt den Begriff der proaktiven Authentifizierung wobei im Request vorhandene Credentials immer abgeprüft werden und falls diese nicht gültig sind, wird auch der Zugriff zu public-Pages verwehrt.

2.3.1. Basic HTTP authentication

  • HTTP Basic Authentication is one of the least resource-demanding techniques that enforce access controls to the Web resources. It uses fields in the HTTP header and does not require HTTP cookies, session identifiers, or login pages.

  • An HTTP user agent, such as a web browser, uses an Authorization header to provide a user name and password in each HTTP request. The header is specified as Authorization: Basic <credentials>, where credentials are the Base64 encoding of the user ID and password joined by a colon, as shown in the following example.

  • Sources:

2.3.2. Form HTTP authentication

  • Quarkus provides form based authentication that works in a similar manner to traditional Servlet form based auth. Unlike traditional form authentication, the authenticated user is not stored in an HTTP session, as Quarkus does not provide clustered HTTP session support.

  • Instead, the authentication information is stored in an encrypted cookie, which can be read by all members of the cluster (provided they all share the same encryption key).

  • Sources:

2.3.3. WebAuthn authentication

  • The Web Authentication API (also known as WebAuthn) is a specification written by the W3C and FIDO, with the participation of Google, Mozilla, Microsoft, Yubico, and others. The API allows servers to register and authenticate users using public key cryptography instead of a password.

  • With WebAuthn, servers can integrate with authenticators such as the YubiKey, a USB token, a smart phone, Apple’s Touch ID, and Windows Hello. The private key is securely stored on the device, while the server stores the public key and randomly generates challenges for the authenticator to sign. The signature proves possession of the private key, and the random challenge prevents replay attacks. source

  • Sources:

2.3.4. (Mutual TLS Authentication)

2.3.5. OpenID Connect authentication

2.3.6. JWT authentication

  • Man muss nicht Keycloak verwenden, sondern kann anstelle dessen die JWT selbst erzeugen und verwenden.

  • The quarkus-smallrye-jwt extension provides a MicroProfile JSON Web Token (JWT) 1.2.1 implementation and multiple options to verify signed and encrypted JWT tokens and represents them as org.eclipse.microprofile.jwt.JsonWebToken.

  • quarkus-smallrye-jwt is an alternative to the quarkus-oidc Bearer Token authentication mechanism, and verifies only JWT tokens by using either PEM keys or the refreshable JWK key set. quarkus-smallrye-jwt also provides the JWT generation API, which you can use to easily create signed, inner-signed, and encrypted JWT tokens.

  • Begriffe:

    • RBAC: Role-based Access Control

  • Sources

2.3.7. (OAuth2 authentication)

2.4. Autorisierungsmechanismen

2.4.1. Role-based access control (RBAC)

  • durch Annotationen in den Endpoints wird der Zugriff durch Rollen geregelt.

  • Identity-Provider

    • JDBC-IdentityProvider

    • JPA-IdentityProvider

    • User Properties-IdentityProvider

    • externer Identity Provider zB Keycloak

2.4.2. Centralized Authorization

  • Der Provider (zB Keycloak) enthält alle Infos welche Reolle auf welche Endpoints zugreifen darf.

3. Following Section is "Work in Progress"

  • Frage: Wie kann man eine Applikation schützen?

  • Antwort: Verschiedene Arten bei

  • IdentityProvider zur Authentifizierung (authentication)

    • basic auth

    • authn

    • oidc

    • JWT

    • oauth2

    • LDAP

    • …​

    • Es gibt auch Quarkus-eigene IDentity Provider, die ohne Keycloak funktionieren

      • JDBC-IdentityProvider

      • JPA-IdentityProvider

      • User Properties-IdentityProvider

  • Autorisierung (authorization)

    • Durch Verwendung von Keycloak

      • RBAC: im Code werden durch Anntotaionen die Authorisierung angegeben (@RolesAllowed…​)

      • Policies: Im Code gibt es keine Autorisierungs-Annotationen. Sämtliche Routes werden für die einzelnen Rollen im Keycloak definiert

4. Keycloak Role-Based Access Control (RBAC)

5. Keycloak w/ Policies

6. Keycloak w/ Angular

7. Security

7.1. JWT RBAC

7.2. Security w/ JDBC Realm

7.3. Security w/ JPA

7.4. Security w/ Properties