Skip to content

Commit

Permalink
IDE-Auto-Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cuioss committed Jul 18, 2023
1 parent d3e08e8 commit 65b4758
Show file tree
Hide file tree
Showing 186 changed files with 2,129 additions and 2,386 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public interface AuthenticatedUserInfo extends Serializable {

/**
* Bean name for looking up instances.
*
*
* @deprecated owolff: Should solely be used with types
*/
@Deprecated(forRemoval = true)
Expand Down Expand Up @@ -59,26 +59,26 @@ default boolean isUserInRole(String roleName) {
String getDisplayName();

/**
* @return the (technical) identifier for the currently authenticated user to be used with
* {@link #getSystem()}.
* @return the (technical) identifier for the currently authenticated user to be
* used with {@link #getSystem()}.
*/
String getIdentifier();

/**
* @return the (technical) qualified identifier for the currently authenticated user to be used
* without {@link #getSystem()}.
* @return the (technical) qualified identifier for the currently authenticated
* user to be used without {@link #getSystem()}.
*/
String getQualifiedIdentifier();

/**
* @return the (technical) assigning authority for the {@link #getIdentifier()} of the currently
* authenticated user
* @return the (technical) assigning authority for the {@link #getIdentifier()}
* of the currently authenticated user
*/
String getSystem();

/**
* @return the context map containing additional runtime information
* belonging to the {@link AuthenticatedUserInfo}
* @return the context map containing additional runtime information belonging
* to the {@link AuthenticatedUserInfo}
*/
Map<Serializable, Serializable> getContextMap();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import lombok.Value;

/**
* To signal successful / failed login and logout events (e.g. to the atna logger).
* To signal successful / failed login and logout events (e.g. to the atna
* logger).
*/
@Value
@Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
import javax.inject.Qualifier;

/**
* Defines events that will be fired at login attempt. The payload is {@link LoginEvent}.
* Defines events that will be fired at login attempt. The payload is
* {@link LoginEvent}.
*
* @author Matthias Walliczek
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
import de.cuioss.portal.configuration.common.PortalPriorities;

/**
* To enrich an {@link AuthenticatedUserInfo} created by the {@link AuthenticationFacade}.
* To enrich an {@link AuthenticatedUserInfo} created by the
* {@link AuthenticationFacade}.
* <p>
* Implementations of this interface will be called as part of
* {@link AuthenticationFacade#retrieveCurrentAuthenticationContext(HttpServletRequest)}.
* <p>
* Multiple implementations can be specified, and differentiated by {@link PortalPriorities}.
* Multiple implementations can be specified, and differentiated by
* {@link PortalPriorities}.
* <p>
* The highest priority is called last.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import javax.inject.Qualifier;

/**
* Defines events that will be fired on changes on user-credentials. The payload is the new user of
* type {@link AuthenticatedUserInfo}.
* Defines events that will be fired on changes on user-credentials. The payload
* is the new user of type {@link AuthenticatedUserInfo}.
*
* @author Oliver Wolff
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import de.cuioss.portal.authentication.AuthenticatedUserInfo;

/**
* Basic interface for cui-portals authentication mechanism. This variant is used by sso logins
* Basic interface for cui-portals authentication mechanism. This variant is
* used by sso logins
*
* @author Matthias Walliczek
*
Expand All @@ -16,17 +17,18 @@ public interface AuthenticationFacade {
* Access the current {@link AuthenticatedUserInfo}.
*
* @param servletRequest The servlet request.
* @return Returns <code>null</code> in case no authentication has taken place. In case of a
* existing authentication a populated {@link AuthenticatedUserInfo} instance is
* returned.
* @return Returns <code>null</code> in case no authentication has taken place.
* In case of a existing authentication a populated
* {@link AuthenticatedUserInfo} instance is returned.
*/
AuthenticatedUserInfo retrieveCurrentAuthenticationContext(HttpServletRequest servletRequest);

/**
* Logs out the currently authenticated user.
*
* @param servletRequest The current servlet request that triggered the logout.
* @return Returns a boolean indicating whether the logout request was successful.
* @return Returns a boolean indicating whether the logout request was
* successful.
*/
boolean logout(HttpServletRequest servletRequest);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
import lombok.experimental.UtilityClass;

/**
* Provides constants for all authentication-modules as there are {@link AuthenticatedUserInfo} for
* not logged in user and keys for the resource bundles, defined at cdi-portal-core-impl module
* Provides constants for all authentication-modules as there are
* {@link AuthenticatedUserInfo} for not logged in user and keys for the
* resource bundles, defined at cdi-portal-core-impl module
*
* @author Oliver Wolff
*/
Expand All @@ -21,26 +22,26 @@ public class AuthenticationResults {
private static final String NOT_LOGGED_IN2 = "Not logged in";

/**
* An {@link AuthenticatedUserInfo} with {@link AuthenticatedUserInfo#isAuthenticated()}
* returning false
* An {@link AuthenticatedUserInfo} with
* {@link AuthenticatedUserInfo#isAuthenticated()} returning false
*/
public static final AuthenticatedUserInfo NOT_LOGGED_IN =
BaseAuthenticatedUserInfo.builder().displayName(NOT_LOGGED_IN2)
.authenticated(false).build();
public static final AuthenticatedUserInfo NOT_LOGGED_IN = BaseAuthenticatedUserInfo.builder()
.displayName(NOT_LOGGED_IN2).authenticated(false).build();

/**
* The key for the message "The credentials you provided are not complete".
*/
public static final String KEY_INCOMPLETE_CREDENTIALS = "portal.authentication.error.incomplete_credentials";

/**
* The key for the message "The system is not configured properly, contact your administrator".
* The key for the message "The system is not configured properly, contact your
* administrator".
*/
public static final String KEY_INVALID_CONFIGURATION = "portal.authentication.error.invalid_configuration";

/**
* The key for the message "Cannot login with the supplied user details. Please check your
* inputs".
* The key for the message "Cannot login with the supplied user details. Please
* check your inputs".
*/
public static final String KEY_INVALID_CREDENTIALS = "page.login.message.loginFailure";

Expand All @@ -51,43 +52,43 @@ public class AuthenticationResults {

/**
* {@link ResultObject} with {@link ResultObject#getState()} is
* {@code RequestResultState#ERROR}, the key {@link #KEY_INCOMPLETE_CREDENTIALS} and the
* default result {@link #NOT_LOGGED_IN}
* {@code RequestResultState#ERROR}, the key {@link #KEY_INCOMPLETE_CREDENTIALS}
* and the default result {@link #NOT_LOGGED_IN}
*/
public static final ResultObject<AuthenticatedUserInfo> RESULT_INCOMPLETE_CREDENTIALS =
invalidResultKey(KEY_INCOMPLETE_CREDENTIALS, null, null);
public static final ResultObject<AuthenticatedUserInfo> RESULT_INCOMPLETE_CREDENTIALS = invalidResultKey(
KEY_INCOMPLETE_CREDENTIALS, null, null);

/**
* {@link ResultObject} with {@link ResultObject#getState()} is
* {@code RequestResultState#ERROR}, the key {@link #KEY_INVALID_CONFIGURATION} and the
* default result {@link #NOT_LOGGED_IN}
* {@code RequestResultState#ERROR}, the key {@link #KEY_INVALID_CONFIGURATION}
* and the default result {@link #NOT_LOGGED_IN}
*/
public static final ResultObject<AuthenticatedUserInfo> RESULT_INVALID_CONFIGURATION =
invalidResultKey(KEY_INVALID_CONFIGURATION, null, null);
public static final ResultObject<AuthenticatedUserInfo> RESULT_INVALID_CONFIGURATION = invalidResultKey(
KEY_INVALID_CONFIGURATION, null, null);

/**
* @param reason the text to be displayed as reason.
* @param username the username entered by the user (e.g. to be added to the atna event)
* @param cause the optional throwable to be wrapped
* @param reason the text to be displayed as reason.
* @param username the username entered by the user (e.g. to be added to the
* atna event)
* @param cause the optional throwable to be wrapped
*
* @return {@link ResultObject} with {@link ResultObject#getState()} is
* {@code RequestResultState#ERROR}, the given reason as message and the
* default result {@link #NOT_LOGGED_IN}
*/
public static final ResultObject<AuthenticatedUserInfo> invalidResult(final String reason,
final String username, final Throwable cause) {
public static final ResultObject<AuthenticatedUserInfo> invalidResult(final String reason, final String username,
final Throwable cause) {
return new ResultObject.Builder<AuthenticatedUserInfo>()
.validDefaultResult(
BaseAuthenticatedUserInfo.builder().displayName(NOT_LOGGED_IN2).identifier(username)
.authenticated(false).build())
.state(ResultState.ERROR)
.resultDetail(new ResultDetail(new DisplayName(reason), cause)).build();
.validDefaultResult(BaseAuthenticatedUserInfo.builder().displayName(NOT_LOGGED_IN2).identifier(username)
.authenticated(false).build())
.state(ResultState.ERROR).resultDetail(new ResultDetail(new DisplayName(reason), cause)).build();
}

/**
* @param reasonKey the key for resolving the reason text.
* @param username the username entered by the user (e.g. to be added to the atna event)
* @param cause the optional throwable to be wrapped
* @param username the username entered by the user (e.g. to be added to the
* atna event)
* @param cause the optional throwable to be wrapped
*
* @return {@link ResultObject} with {@link ResultObject#getState()} is
* {@code RequestResultState#ERROR}, the given reason as message and the
Expand All @@ -96,21 +97,19 @@ public static final ResultObject<AuthenticatedUserInfo> invalidResult(final Stri
public static final ResultObject<AuthenticatedUserInfo> invalidResultKey(final String reasonKey,
final String username, final Throwable cause) {
return new ResultObject.Builder<AuthenticatedUserInfo>()
.validDefaultResult(
BaseAuthenticatedUserInfo.builder().displayName(NOT_LOGGED_IN2).identifier(username)
.authenticated(false).build())
.state(ResultState.ERROR)
.resultDetail(new ResultDetail(new LabeledKey(reasonKey), cause)).build();
.validDefaultResult(BaseAuthenticatedUserInfo.builder().displayName(NOT_LOGGED_IN2).identifier(username)
.authenticated(false).build())
.state(ResultState.ERROR).resultDetail(new ResultDetail(new LabeledKey(reasonKey), cause)).build();
}

/**
* @param userInfo must not be null and should be an authenticated User
*
* @return {@link ResultObject} with {@link ResultObject#getState()} is
* {@code RequestResultState#VALID}, the given reason userInfo as payload
* {@code RequestResultState#VALID}, the given reason userInfo as
* payload
*/
public static final ResultObject<AuthenticatedUserInfo> validResult(final AuthenticatedUserInfo userInfo) {
return new ResultObject.Builder<AuthenticatedUserInfo>().result(userInfo)
.state(ResultState.VALID).build();
return new ResultObject.Builder<AuthenticatedUserInfo>().result(userInfo).state(ResultState.VALID).build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ public abstract class BaseAuthenticationFacade implements AuthenticationFacade {

/**
* Enriches the given {@link AuthenticatedUserInfo} using the available
* {@link PortalUserEnricher} implemenentations that are part of the cdi-context.
* {@link PortalUserEnricher} implemenentations that are part of the
* cdi-context.
* <p>
* The {@linkplain PortalUserEnricher} are sorted via {@link PortalPriorities} if multiple
* instances are found.
* The {@linkplain PortalUserEnricher} are sorted via {@link PortalPriorities}
* if multiple instances are found.
* <p>
* The enriched {@linkplain AuthenticatedUserInfo} is returned as result.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,26 @@
public interface FormBasedAuthenticationFacade extends AuthenticationFacade {

/**
* Authenticates a user with the provided credentials. The implementation is responsible for
* invalidating the old and creating a new session.
* Authenticates a user with the provided credentials. The implementation is
* responsible for invalidating the old and creating a new session.
*
* @param request The current {@link HttpServletRequest} that needs to be authenticated.
* @param request The current {@link HttpServletRequest} that needs to be
* authenticated.
* @param credentials The credentials for authentication
* @return A {@link ResultObject} with the corresponding {@link AuthenticatedUserInfo}
* with {@link AuthenticatedUserInfo#isAuthenticated()} being {@code true} in case of
* successful logins, otherwise it will provide the corresponding error message to be
* displayed.
* @return A {@link ResultObject} with the corresponding
* {@link AuthenticatedUserInfo} with
* {@link AuthenticatedUserInfo#isAuthenticated()} being {@code true} in
* case of successful logins, otherwise it will provide the
* corresponding error message to be displayed.
*/
ResultObject<AuthenticatedUserInfo> login(HttpServletRequest request, LoginCredentials credentials);

/**
* Provides list of available systems. Please note that no particular ordering is added on top.
* The content is displayed on ui level as provided.
* Provides list of available systems. Please note that no particular ordering
* is added on top. The content is displayed on ui level as provided.
*
* @return The map providing the available system data. Must not be null but may be empty.
* @return The map providing the available system data. Must not be null but may
* be empty.
*/
List<UserStore> getAvailableUserStores();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
import lombok.ToString;

/**
* Base Implementation of {@link AuthenticatedUserInfo} suitable for most uses-cases. It can be
* overwritten but the extension point for custom attributes is {@link #getContextMap()}
* Base Implementation of {@link AuthenticatedUserInfo} suitable for most
* uses-cases. It can be overwritten but the extension point for custom
* attributes is {@link #getContextMap()}
*
* @author Oliver Wolff
*/
Expand Down Expand Up @@ -105,8 +106,7 @@ public BaseAuthenticatedUserInfoBuilder identifier(final String identifier) {
* @param qualifiedIdentifier
* @return the builder for {@link BaseAuthenticatedUserInfo}
*/
public BaseAuthenticatedUserInfoBuilder qualifiedIdentifier(
final String qualifiedIdentifier) {
public BaseAuthenticatedUserInfoBuilder qualifiedIdentifier(final String qualifiedIdentifier) {
this.qualifiedIdentifier = qualifiedIdentifier;
return this;
}
Expand Down Expand Up @@ -144,8 +144,7 @@ public BaseAuthenticatedUserInfoBuilder roles(final List<String> roles) {
* @param contextMap
* @return the builder for {@link BaseAuthenticatedUserInfo}
*/
public BaseAuthenticatedUserInfoBuilder contextMap(
final Map<Serializable, Serializable> contextMap) {
public BaseAuthenticatedUserInfoBuilder contextMap(final Map<Serializable, Serializable> contextMap) {
this.contextMap = contextMap;
return this;
}
Expand All @@ -155,8 +154,7 @@ public BaseAuthenticatedUserInfoBuilder contextMap(
* @param value
* @return the builder for {@link BaseAuthenticatedUserInfo}
*/
public BaseAuthenticatedUserInfoBuilder contextMapElement(final Serializable key,
final Serializable value) {
public BaseAuthenticatedUserInfoBuilder contextMapElement(final Serializable key, final Serializable value) {
contextMap.put(key, value);
return this;
}
Expand All @@ -165,10 +163,8 @@ public BaseAuthenticatedUserInfoBuilder contextMapElement(final Serializable key
* @return the built {@link BaseAuthenticatedUserInfo}
*/
public BaseAuthenticatedUserInfo build() {
final var baseAuthenticatedUserInfo =
new BaseAuthenticatedUserInfo(
authenticated, displayName, identifier,
qualifiedIdentifier, system);
final var baseAuthenticatedUserInfo = new BaseAuthenticatedUserInfo(authenticated, displayName, identifier,
qualifiedIdentifier, system);
if (!contextMap.isEmpty()) {
baseAuthenticatedUserInfo.contextMap.putAll(contextMap);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ public class UserStore implements Serializable {
/**
* Constructor.
*
* @param name
* to be set, must not be null. Will be used for
* {@link #getName()} and {@link #getDisplayName()}
* @param name to be set, must not be null. Will be used for {@link #getName()}
* and {@link #getDisplayName()}
*/
public UserStore(@NonNull final String name) {
this.name = name;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Provides classes / structures representing runtime information for a currently logged in user.
* Provides classes / structures representing runtime information for a
* currently logged in user.
*
* @author Oliver Wolff
*/
Expand Down
Loading

0 comments on commit 65b4758

Please sign in to comment.