Skip to content

Commit

Permalink
IDE-Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cuioss committed Jul 16, 2024
1 parent 4cc140f commit 2e01527
Show file tree
Hide file tree
Showing 78 changed files with 244 additions and 211 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package de.cuioss.portal.authentication;

import java.io.Serial;
import java.io.Serializable;

import lombok.Builder;
Expand All @@ -29,6 +30,7 @@
@Builder
public class LoginEvent implements Serializable {

@Serial
private static final long serialVersionUID = -2436530653889693514L;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import static java.util.Objects.requireNonNull;

import java.io.Serial;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -41,6 +42,7 @@
@EqualsAndHashCode
public class BaseAuthenticatedUserInfo implements AuthenticatedUserInfo {

@Serial
private static final long serialVersionUID = 5675055136230020827L;

@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package de.cuioss.portal.authentication.model;

import java.io.Serial;
import java.io.Serializable;

import lombok.EqualsAndHashCode;
Expand All @@ -35,6 +36,7 @@
@ToString
public class UserStore implements Serializable {

@Serial
private static final long serialVersionUID = -1854435554671404250L;

@Getter
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions modules/authentication/portal-authentication-oauth/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
See https://wiki.icw.int/display/CUI/Oauth2+Authentication

Please add a microprofile rest implementation to the classpath - if not using cui parent poms.

## Adding RestEasy dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@
/**
* Provide the keys for the application.properties to configure oauth2.
* <p>
* See also https://wiki.icw.int/display/CUI/Howto+enable+Oauth2+Authentication
*
* @author Matthias Walliczek
*/
@UtilityClass
public class OAuthConfigKeys {

/**
* Base key for constructing keys root at 'authentication.'.
* Base key for constructing key root at 'authentication.'.
*/
public static final String AUTHENTICATION_BASE = "authentication.";

Expand Down Expand Up @@ -152,7 +151,6 @@ public class OAuthConfigKeys {
* <p>
* The url of the server that provides the authentication endpoints. It is
* interpreted as a complete url including context path, e.g.
* https://sso-evaluation.dev.icw.int:9443/
* </p>
*/
public static final String OPEN_ID_SERVER_BASE_URL = OPEN_ID_SERVER_BASE + "url";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
*/
package de.cuioss.portal.authentication.oauth;

import java.io.Serial;

/**
* @author Matthias Walliczek
*/
public class OauthAuthenticationException extends RuntimeException {

@Serial
private static final long serialVersionUID = -2351542706407596661L;

public OauthAuthenticationException(final String string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package de.cuioss.portal.authentication.oauth;

import java.io.Serial;
import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
Expand All @@ -30,6 +31,7 @@
@JsonIgnoreProperties(ignoreUnknown = true)
public class Token implements Serializable {

@Serial
private static final long serialVersionUID = 1814898874197817661L;

private String id_token;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static java.util.Objects.requireNonNull;

import java.io.IOException;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
Expand Down Expand Up @@ -83,6 +84,7 @@ public class Oauth2AuthenticationFacadeImpl extends BaseAuthenticationFacade

private static final String ERROR_INVALID_SCOPE = "invalid_scope";

@Serial
private static final long serialVersionUID = -7635870199193359039L;

private static final String AUTHENTICATED_USER_INFO_KEY = "AuthenticatedUserInfo";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package de.cuioss.portal.authentication.oauth.impl;

import java.io.Serial;
import java.util.List;

import de.cuioss.portal.authentication.oauth.Oauth2Configuration;
Expand All @@ -34,6 +35,7 @@
@NoArgsConstructor
public class Oauth2ConfigurationImpl implements Oauth2Configuration {

@Serial
private static final long serialVersionUID = 6666334248327168722L;

private String clientId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package de.cuioss.portal.authentication.oauth.impl;

import java.io.Serial;
import java.util.Optional;

import de.cuioss.portal.authentication.AuthenticatedUserInfo;
Expand All @@ -25,6 +26,7 @@
@RequiredArgsConstructor
public class OauthAuthenticatedUserInfo implements AuthenticatedUserInfo {

@Serial
private static final long serialVersionUID = 1L;
/**
* The key of the accessToken to be stored in the
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ authentication.oidc.client.logout.params.add_id_token_hint=true

# The url of the server that provides the authentication endpoints.
# It is interpreted as a complete url including context path,
# e.g. https://sso-evaluation.dev.icw.int:9443/auth
# Must be set by the installation.
#authentication.oidc.server.url=

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import jakarta.servlet.http.HttpServletResponse;
import jakarta.ws.rs.core.MediaType;

import org.jetbrains.annotations.NotNull;
import org.junit.platform.commons.logging.Logger;
import org.junit.platform.commons.logging.LoggerFactory;

Expand Down Expand Up @@ -124,7 +125,7 @@ public List<RecordedRequest> nonWellKnownRequests(MockWebServer mockWebServer) t
}

@Override
public MockResponse dispatch(RecordedRequest request) throws InterruptedException {
public @NotNull MockResponse dispatch(RecordedRequest request) throws InterruptedException {
LOGGER.info(() -> "Serve request " + request.getPath());
return switch (request.getPath()) {
case "/" + OIDC_DISCOVERY_PATH -> new MockResponse().setResponseCode(HttpServletResponse.SC_OK)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Oauth2AuthenticationFacadeImplTest
private MockWebServer mockWebServer;

@Getter
private OIDCWellKnownDispatcher dispatcher = new OIDCWellKnownDispatcher();
private final OIDCWellKnownDispatcher dispatcher = new OIDCWellKnownDispatcher();

@BeforeEach
void beforeEach() {
Expand Down Expand Up @@ -305,9 +305,6 @@ void testRetrieveIdToken() {

@Test
void retrieveClientLogoutUrlWithParams() {
// configuration.fireEvent(DeprecatedOauth2ConfigurationKeys.OAUTH2LOGOUT_URI,
// "http://logout");

var token = new Token();
token.setId_token("idtoken");
var testUser = BaseAuthenticatedUserInfo.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Oauth2DiscoveryConfigurationProducerTest
private PortalTestConfiguration configuration;

@Getter
private OIDCWellKnownDispatcher dispatcher = new OIDCWellKnownDispatcher();
private final OIDCWellKnownDispatcher dispatcher = new OIDCWellKnownDispatcher();

@Test
void testInit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Oauth2ServiceImplTest implements ShouldHandleObjectContracts<Oauth2Service
private MockHttpServletRequest servletRequest;

@Getter
private OIDCWellKnownDispatcher dispatcher = new OIDCWellKnownDispatcher();
private final OIDCWellKnownDispatcher dispatcher = new OIDCWellKnownDispatcher();

@BeforeEach
void beforeEach() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package de.cuioss.portal.authentication.oauth.impl;

import java.io.Serial;
import java.io.Serializable;

import jakarta.servlet.http.HttpServletRequest;
Expand All @@ -29,6 +30,7 @@

public class Oauth2ServiceMock implements Oauth2Service, Serializable {

@Serial
private static final long serialVersionUID = -2635417375165112609L;

@Getter
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ public class PortalConfigurationKeys {
* Context parameter prefix within configuration-subsystem with the name
* portal.dashboard.widget.
* <p>
* Activates dashboard widgets (see
* com.icw.ehf.cui.portal.cdi.api.dashboard.PortalDashboardWidget) and defines
* Activates dashboard widgets and defines
* their order.
*/
public static final String DASHBOARD_WIDGET = PORTAL_BASE + "dashboard.widget.";
Expand All @@ -108,12 +107,12 @@ public class PortalConfigurationKeys {
* portal.menu.
* <p>
* Activates navigation menu items (see
* com.icw.ehf.cui.components.bootstrap.menu.model.NavigationMenuItem and
* de.cuioss.jsf.api.components.model.menu.NavigationMenuItem and
* defines their order and hierarchy.
* </p>
* <p>
* Each entry consists of a logical name matching
* com.icw.ehf.cui.components.bootstrap.menu.model.NavigationMenuItem#getId(),
* NavigationMenuItem#getId(),
* and the properties "enabled", "order" and "parent".
* </p>
* Example:
Expand Down Expand Up @@ -297,8 +296,7 @@ public class PortalConfigurationKeys {
* A comma separated list of libraries that should be handled by the
* CuiResourceHandler. Handled by the resource handler means selecting the
* .min-version of the resource is available and adding a cache-buster to the
* resource request. The default value for the CDI portal is:
* "com.icw.cui.fonts,com.icw.portal.css,com.icw.cui.javascript,thirdparty.legacy.js,thirdparty.js"
* resource request.
* </p>
*/
public static final String RESOURCE_HANDLED_LIBRARIES = RESOURCE_BASE + "handled_libraries";
Expand Down Expand Up @@ -616,7 +614,7 @@ public class PortalConfigurationKeys {
* <p>
* Defines whether the listener for tracing faces-requests is enabled. Defaults
* to {@code false}. In order to activate tracing on the application log you
* must set the Logger for de.icw.cui.portal.application.metrics.RequestTracer
* must set the Logger for de.cuioss.portal.ui.runtime.application.listener.metrics.RequestTracer
* to debug. In case of metrics being enabled as well it will register as
* metric.
* </p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package de.cuioss.portal.configuration.cache;

import java.io.Serial;
import java.io.Serializable;
import java.util.concurrent.TimeUnit;

Expand All @@ -35,6 +36,7 @@
@ToString
public class CacheConfig implements Serializable {

@Serial
private static final long serialVersionUID = -9171609866171876392L;

/** The config key suffix for the {@link #expiration} property */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
*/
package de.cuioss.portal.configuration.connections.exception;

import java.io.Serial;

/**
* @author Oliver Wolff
*/
public class ConnectionConfigurationException extends ConnectionException {

@Serial
private static final long serialVersionUID = -9083478212303783709L;

private final String message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

import lombok.Getter;

import java.io.Serial;

/**
* General exception to be thrown if anything goes wrong while trying to
* <em>establish</em> the connection. Other exceptions that are specific to the
Expand All @@ -26,6 +28,7 @@
*/
public class ConnectionException extends Exception {

@Serial
private static final long serialVersionUID = 3441459660135305431L;

@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import lombok.RequiredArgsConstructor;
import lombok.ToString;

import java.io.Serial;

/**
* Basic Implementation of {@link TokenResolver} used for static tokens that do
* not change for a specific user.
Expand All @@ -33,6 +35,7 @@
@ToString(of = "key") // Only key, because Token may be considered as sensitive data
public class StaticTokenResolver implements TokenResolver {

@Serial
private static final long serialVersionUID = 7523596484663692845L;

@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@
*/
package de.cuioss.portal.configuration.util;

import java.io.Serial;

/**
* Exception for a configuration key whose default value contains a placeholder
* again for too many times.
*/
public final class ConfigKeyNestingException extends IllegalStateException {

@Serial
private static final long serialVersionUID = 1L;

public ConfigKeyNestingException(String configKey) {
Expand Down
Loading

0 comments on commit 2e01527

Please sign in to comment.