Fix auth -> authentication in some props in SDK (#2839)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-11-28 09:13:41 +02:00
committed by GitHub
parent 42384b7e31
commit 203598f3a4
29 changed files with 129 additions and 121 deletions

View File

@@ -22,11 +22,11 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
/**
* Api for handling basic auth user validation
* Api for handling basic authentication user validation
*/
@SuppressWarnings("squid:S1609")
@Tag(
name = "Basic Authentication", description = "API for basic auth user validation.",
name = "Basic Authentication", description = "API for basic authentication user validation.",
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = BASIC_AUTH_ORDER)))
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
public interface MgmtBasicAuthRestApi {

View File

@@ -81,7 +81,7 @@ public final class MgmtRestConstants {
*/
public static final String ROLLOUT_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/rollouts";
/**
* The basic auth validation mapping
* The basic authentication validation mapping
*/
public static final String AUTH_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/userinfo";
/**

View File

@@ -20,7 +20,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RestController;
/**
* REST Resource handling basic auth validation.
* REST Resource handling basic authentication validation.
*/
@RestController
public class MgmtBasicAuthResource implements MgmtBasicAuthRestApi {

View File

@@ -51,7 +51,7 @@ import org.springframework.web.context.WebApplicationContext;
* Test for {@link MgmtBasicAuthResource}.
* <p/>
* Feature: Component Tests - Management API<br/>
* Story: Basic auth Userinfo Resource
* Story: Basic authentication Userinfo Resource
*/
@ActiveProfiles({ "test" })
@ExtendWith({ TestLoggerExtension.class, SharedSqlTestDatabaseExtension.class })
@@ -80,7 +80,7 @@ class MgmtBasicAuthResourceTest {
MockMvc defaultMock;
/**
* Test of userinfo api with basic auth validation
* Test of userinfo api with basic authentication validation
*/
@Test
@WithUser(principal = TEST_USER, authorities = {"READ", "WRITE", "DELETE"})
@@ -97,7 +97,7 @@ class MgmtBasicAuthResourceTest {
}
/**
* Test of userinfo api with invalid basic auth fails
* Test of userinfo api with invalid basic authentication fails
*/
@Test
void validateBasicAuthFailsWithInvalidCredentials() throws Exception {

View File

@@ -106,7 +106,7 @@ public class MgmtSecurityConfiguration {
final HttpSecurity http,
@Autowired(required = false) @Qualifier("hawkbitOAuth2ResourceServerCustomizer") final Customizer<OAuth2ResourceServerConfigurer<HttpSecurity>> oauth2ResourceServerCustomizer,
// called just before build of the SecurityFilterChain.
// could be used for instance to set auth provider
// could be used for instance to set authentication provider
// Note: implementation of the customizer shall always take in account what is the already set by the hawkBit
@Autowired(required = false) @Qualifier("hawkbitHttpSecurityCustomizer") final Customizer<HttpSecurity> httpSecurityCustomizer,
final SystemManagement systemManagement) throws Exception {
@@ -120,7 +120,7 @@ public class MgmtSecurityConfiguration {
.anonymous(AbstractHttpConfigurer::disable)
.csrf(AbstractHttpConfigurer::disable)
.addFilterAfter(
// Servlet filter to create metadata after successful auth over RESTful.
// Servlet filter to create metadata after successful authentication over RESTful.
(request, response, chain) -> {
final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication != null && authentication.isAuthenticated()) {