-
-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(java)!: switch idioms, deprecations, Lombok, warning gate #198
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
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
dc2de78
build(maven): switch on compiler deprecation lint in the parent POM
cuioss-oliver 72ac107
refactor(config)!: migrate quarkus.log.file.enable to quarkus.log.fil…
cuioss-oliver 42a45be
refactor(config)!: bind AuthConfig.require to a Require enum
cuioss-oliver a616a26
refactor(edge): express three single-subject dispatch chains as switches
cuioss-oliver 781bdd6
refactor(edge): retire the five Java deprecation sites
cuioss-oliver 8534f12
build: make a compiler warning fail the build reactor-wide
cuioss-oliver 793b42d
fix(auth): make the Require dispatch compiler-checked for exhaustiveness
cuioss-oliver be0eeba
docs: address CodeRabbit review on #198
cuioss-oliver File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
api-sheriff/src/main/java/de/cuioss/sheriff/gateway/config/model/Require.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| /* | ||
| * Copyright © 2026 CUI-OpenSource-Software (info@cuioss.de) | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package de.cuioss.sheriff.gateway.config.model; | ||
|
|
||
| import java.util.Locale; | ||
|
|
||
| /** | ||
| * The authentication posture an {@link AuthConfig auth} block requires. | ||
| * <p> | ||
| * The value set is declared in {@code gateway.schema.json} and | ||
| * {@code endpoint.schema.json}, so an unknown value is refused during schema | ||
| * validation, before binding ever reaches this type. Modelling the posture as an | ||
| * enum rather than a {@link String} is therefore a <em>type-safety</em> change and | ||
| * carries no behavioural delta at the configuration boundary: it replaces the three | ||
| * duplicated {@code REQUIRE_*} string-constant sets that had drifted across the | ||
| * validator, the authentication stage and the edge route with one shared type, and | ||
| * lets the posture dispatch be a switch over a closed set. | ||
| * <p> | ||
| * Compile-time exhaustiveness is <em>not</em> automatic. A switch statement whose labels | ||
| * are all enum constants is a legacy switch, which javac neither requires to be exhaustive | ||
| * nor warns about — adding a fourth constant would compile clean and fall through silently. | ||
| * A dispatch that must not miss a posture therefore carries a {@code case null} arm, which | ||
| * makes it an enhanced switch and obliges javac to reject a non-exhaustive one. See | ||
| * {@code AuthenticationStage#process}, where a missed posture would leave a route | ||
| * unenforced while still reporting itself authenticated. | ||
| * <p> | ||
| * The constants are uppercase per Java convention; the case-insensitive YAML binding | ||
| * ({@code MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS}) maps the lowercase | ||
| * {@code none} / {@code bearer} / {@code session} configuration values onto them. | ||
| * | ||
| * @author API Sheriff Team | ||
| * @since 1.0 | ||
| */ | ||
| public enum Require { | ||
|
|
||
| /** No authentication required: the surface is anonymous. */ | ||
| NONE, | ||
| /** A validated bearer token is required; the gateway needs a configured issuer. */ | ||
| BEARER, | ||
| /** An authenticated session is required; the gateway needs an OIDC block. */ | ||
| SESSION; | ||
|
|
||
| /** | ||
| * The configuration spelling of this posture — the lowercase form as it appears in | ||
| * {@code gateway.yaml}. | ||
| * <p> | ||
| * Overridden so that operator-facing text renders the posture the way the operator | ||
| * wrote it: validation errors and the route-posture log line interpolate this value | ||
| * with {@code %s}, and reporting {@code BEARER} for a file that says {@code bearer} | ||
| * would make the message harder to trace back to the offending line. Binding is | ||
| * unaffected — Jackson reads enums by constant name (case-insensitively here) and | ||
| * does not consult {@code toString()}. | ||
| * | ||
| * @return the lowercase configuration value for this posture | ||
| */ | ||
| @Override | ||
| public String toString() { | ||
| return name().toLowerCase(Locale.ROOT); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.