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?
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)
-
Quarkus provides mTLS authentication so that you can authenticate users based on their X.509 certificates.
2.3.5. OpenID Connect authentication
-
The Bearer Token mechanism extracts the token from the HTTP Authorization header. The Authorization Code Flow mechanism redirects the user to an OIDC provider to authenticate the identity of the user. After the user is redirected back to Quarkus, the mechanism completes the authentication process by exchanging the provided code that was granted for the ID, access, and refresh tokens.
-
Als OIDC-Provider werden oft Google, Microsoft, Yahoo, … verwendet.
-
Als on-premise Lösung verwenden wir Keycloak
-
Begriffe
-
Bearer token
-
Authorization Code Flow
-
OIDC provider (OpenID Connect provider)
-
-
Sources
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
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
-
-