Skip to content

Commit

Permalink
Merge pull request Waffle#2286 from hazendaz/master
Browse files Browse the repository at this point in the history
Code cleanup per checkstyle
  • Loading branch information
hazendaz authored Mar 18, 2024
2 parents 867d3e5 + a90480a commit 774eb69
Show file tree
Hide file tree
Showing 51 changed files with 191 additions and 169 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2010-2022 The Waffle Project Contributors: https://github.com/Waffle/waffle/graphs/contributors
* Copyright (c) 2010-2024 The Waffle Project Contributors: https://github.com/Waffle/waffle/graphs/contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -39,7 +39,7 @@ public class Application {
* @param args
* arguments passed into spring boot application.
*/
public static void main(String[] args) {
public static void main(final String[] args) {
SpringApplication.run(Application.class, args);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2010-2022 The Waffle Project Contributors: https://github.com/Waffle/waffle/graphs/contributors
* Copyright (c) 2010-2024 The Waffle Project Contributors: https://github.com/Waffle/waffle/graphs/contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -45,7 +45,7 @@ public class DemoController {
* @return response text
*/
@GetMapping
public String demo(Authentication auth) {
public String demo(final Authentication auth) {
return String.format("Hello, %s. You have authorities: %s", auth.getPrincipal(),
auth.getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.joining(", ")));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ public class SecurityConfig {
* @param entryPoint
* the entry point
*/
public SecurityConfig(NegotiateSecurityFilter filter, NegotiateSecurityFilterEntryPoint entryPoint) {
public SecurityConfig(final NegotiateSecurityFilter filter, final NegotiateSecurityFilterEntryPoint entryPoint) {
this.filter = filter;
this.entryPoint = entryPoint;
}

@Bean
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
SecurityFilterChain filterChain(final HttpSecurity http) throws Exception {
http.authorizeHttpRequests(requests -> requests.anyRequest().authenticated())
.addFilterBefore(filter, BasicAuthenticationFilter.class)
.exceptionHandling(handling -> handling.authenticationEntryPoint(entryPoint));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2010-2023 The Waffle Project Contributors: https://github.com/Waffle/waffle/graphs/contributors
* Copyright (c) 2010-2024 The Waffle Project Contributors: https://github.com/Waffle/waffle/graphs/contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -39,7 +39,7 @@ public class Application {
* @param args
* arguments passed into spring boot application.
*/
public static void main(String[] args) {
public static void main(final String[] args) {
SpringApplication.run(Application.class, args);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2010-2023 The Waffle Project Contributors: https://github.com/Waffle/waffle/graphs/contributors
* Copyright (c) 2010-2024 The Waffle Project Contributors: https://github.com/Waffle/waffle/graphs/contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -45,7 +45,7 @@ public class DemoController {
* @return response text
*/
@GetMapping
public String demo(Authentication auth) {
public String demo(final Authentication auth) {
return String.format("Hello, %s. You have authorities: %s", auth.getPrincipal(),
auth.getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.joining(", ")));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ public class SecurityConfig {
* @param entryPoint
* the entry point
*/
public SecurityConfig(NegotiateSecurityFilter filter, NegotiateSecurityFilterEntryPoint entryPoint) {
public SecurityConfig(final NegotiateSecurityFilter filter, final NegotiateSecurityFilterEntryPoint entryPoint) {
this.filter = filter;
this.entryPoint = entryPoint;
}

@Bean
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
SecurityFilterChain filterChain(final HttpSecurity http) throws Exception {
http.authorizeHttpRequests(requests -> requests.anyRequest().authenticated())
.addFilterBefore(filter, BasicAuthenticationFilter.class)
.exceptionHandling(handling -> handling.authenticationEntryPoint(entryPoint));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ public class StartEmbeddedJetty {
/** The Constant LOGGER. */
private static final Logger LOGGER = LoggerFactory.getLogger(StartEmbeddedJetty.class);

/**
* Prevents Instantiation of a new start embedded jetty.
*/
private StartEmbeddedJetty() {
// Do not allow instantiation
}

/**
* Main method.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ public class StartEmbeddedJettyValidateNTLMGroup {
/** The logger. */
private static final Logger LOGGER = LoggerFactory.getLogger(StartEmbeddedJettyValidateNTLMGroup.class);

/**
* Prevents Instantiation of a new start embedded jetty validate NTLM group.
*/
private StartEmbeddedJettyValidateNTLMGroup() {
// Do not allow instantiation
}

/**
* The main method.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ public class StartEmbeddedJetty {
/** The Constant LOGGER. */
private static final Logger LOGGER = LoggerFactory.getLogger(StartEmbeddedJetty.class);

/**
* Prevents Instantiation of a new start embedded jetty.
*/
private StartEmbeddedJetty() {
// Do not allow instantiation
}

/**
* Main method.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ public class StartEmbeddedJettyValidateNTLMGroup {
/** The logger. */
private static final Logger LOGGER = LoggerFactory.getLogger(StartEmbeddedJettyValidateNTLMGroup.class);

/**
* Prevents Instantiation of a new start embedded jetty validate NTLM group.
*/
private StartEmbeddedJettyValidateNTLMGroup() {
// Do not allow instantiation
}

/**
* The main method.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2010-2022 The Waffle Project Contributors: https://github.com/Waffle/waffle/graphs/contributors
* Copyright (c) 2010-2024 The Waffle Project Contributors: https://github.com/Waffle/waffle/graphs/contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -77,9 +77,9 @@ public static boolean isPreflight(final HttpServletRequest request) {

CorsPreFlightCheck.LOGGER.debug("[waffle.util.CorsPreflightCheck] check for PRE_FLIGHT Attribute");

/**
/*
* Support Apache CorsFilter which would already add the Attribute cors.request.type with a value "PRE_FLIGHT"
**/
*/
if (corsRequestType != null
&& corsRequestType.equalsIgnoreCase(CorsPreFlightCheck.PRE_FLIGHT_ATTRIBUTE_VALUE)) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.checkerframework.checker.index.qual.NonNegative;

/**
* A {@link Cache} based on {@link com.github.benmanes.caffeine.cache.Cache}
* A {@link Cache} based on {@link com.github.benmanes.caffeine.cache.Cache}.
*
* @param <K>
* the type of keys maintained by this cache
Expand All @@ -53,17 +53,17 @@ public CaffeineCache(@NonNegative final long timeout) {
}

@Override
public V get(K key) {
public V get(final K key) {
return cache.asMap().get(key);
}

@Override
public void put(K key, V value) {
public void put(final K key, final V value) {
cache.put(key, value);
}

@Override
public void remove(K key) {
public void remove(final K key) {
cache.asMap().remove(key);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ public class WindowsAuthProviderImpl implements IWindowsAuthProvider {
*/
private static class ContinueContext {
/** The continue handle. */
CtxtHandle continueHandle;
private CtxtHandle continueHandle;

/** The server credential. */
IWindowsCredentialsHandle serverCredential;
private IWindowsCredentialsHandle serverCredential;

/**
* Instantiates a new continue context.
Expand All @@ -77,7 +77,7 @@ private static class ContinueContext {
* @param windowsCredential
* the windows credential
*/
public ContinueContext(final CtxtHandle handle, final IWindowsCredentialsHandle windowsCredential) {
ContinueContext(final CtxtHandle handle, final IWindowsCredentialsHandle windowsCredential) {
this.continueHandle = handle;
this.serverCredential = windowsCredential;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2010-2020 The Waffle Project Contributors: https://github.com/Waffle/waffle/graphs/contributors
* Copyright (c) 2010-2024 The Waffle Project Contributors: https://github.com/Waffle/waffle/graphs/contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -60,7 +60,7 @@ class WindowsLoginModuleTest {

/** The callback handler. */
@Mocked
CallbackHandler callbackHandler;
private CallbackHandler callbackHandler;

/** The options. */
private Map<String, String> options;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2010-2020 The Waffle Project Contributors: https://github.com/Waffle/waffle/graphs/contributors
* Copyright (c) 2010-2024 The Waffle Project Contributors: https://github.com/Waffle/waffle/graphs/contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -44,23 +44,23 @@ class CorsAwareNegotiateSecurityFilterTest {

/** The cors aware negotiate security filter. */
@Tested
CorsAwareNegotiateSecurityFilter corsAwareNegotiateSecurityFilter;
private CorsAwareNegotiateSecurityFilter corsAwareNegotiateSecurityFilter;

/** The preflight request. */
@Mocked
HttpServletRequest preflightRequest;
private HttpServletRequest preflightRequest;

/** The preflight response. */
@Mocked
HttpServletResponse preflightResponse;
private HttpServletResponse preflightResponse;

/** The chain. */
@Mocked
FilterChain chain;
private FilterChain chain;

/** The filter config. */
@Mocked
FilterConfig filterConfig;
private FilterConfig filterConfig;

/**
* Do filter test cors preflight request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class WindowsPrincipalTest {

/** The windows identity. */
@Mocked
IWindowsIdentity windowsIdentity;
private IWindowsIdentity windowsIdentity;

/**
* Test to string.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2010-2020 The Waffle Project Contributors: https://github.com/Waffle/waffle/graphs/contributors
* Copyright (c) 2010-2024 The Waffle Project Contributors: https://github.com/Waffle/waffle/graphs/contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -39,19 +39,19 @@ class CorsPreFlightCheckTest {

/** The preflight request. */
@Mocked
HttpServletRequest preflightRequest;
private HttpServletRequest preflightRequest;

/** The no origin preflight request. */
@Mocked
HttpServletRequest noOriginPreflightRequest;
private HttpServletRequest noOriginPreflightRequest;

/** The no cors method preflight request. */
@Mocked
HttpServletRequest noCorsMethodPreflightRequest;
private HttpServletRequest noCorsMethodPreflightRequest;

/** The no cors headers preflight header request. */
@Mocked
HttpServletRequest noCorsHeadersPreflightHeaderRequest;
private HttpServletRequest noCorsHeadersPreflightHeaderRequest;

/**
* Test expected cors preflight headers present.
Expand Down Expand Up @@ -101,7 +101,7 @@ void testNoCorsPreflightOriginPresent() {
this.result = "LOGIN";
CorsPreFlightCheckTest.this.noOriginPreflightRequest.getHeader("Access-Control-Request-Headers");
this.result = "X-Request-For";
/** Origin MUST be present with Method and Headers to be a valid CORS request **/
// Origin MUST be present with Method and Headers to be a valid CORS request
CorsPreFlightCheckTest.this.noOriginPreflightRequest.getHeader("Origin");
this.result = null;
}
Expand Down
Loading

0 comments on commit 774eb69

Please sign in to comment.