Skip to content

Commit a3098e2

Browse files
committed
Polish
1 parent aff389f commit a3098e2

File tree

5 files changed

+10
-88
lines changed

5 files changed

+10
-88
lines changed

spring-security-kerberos-client/src/main/java/org/springframework/security/kerberos/client/KerberosRestTemplate.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -163,18 +163,6 @@ public KerberosRestTemplate(String keyTabLocation, String userPrincipal, String
163163
this(keyTabLocation, userPrincipal, password, loginOptions, buildHttpClient());
164164
}
165165

166-
/**
167-
* Instantiates a new kerberos rest template.
168-
*
169-
* @param keyTabLocation the key tab location
170-
* @param userPrincipal the user principal
171-
* @param loginOptions the login options
172-
* @param httpClient the http client
173-
*/
174-
private KerberosRestTemplate(String keyTabLocation, String userPrincipal, Map<String, Object> loginOptions, HttpClient httpClient) {
175-
this(keyTabLocation, userPrincipal, null, loginOptions, httpClient);
176-
}
177-
178166
/**
179167
* Instantiates a new kerberos rest template.
180168
*

spring-security-kerberos-core/src/test/java/org/springframework/security/kerberos/authentication/KerberosServiceAuthenticationProviderTest.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2015 the original author or authors.
2+
* Copyright 2009-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,10 +34,6 @@
3434
import org.springframework.security.core.userdetails.UserDetails;
3535
import org.springframework.security.core.userdetails.UserDetailsService;
3636
import org.springframework.security.core.userdetails.UsernameNotFoundException;
37-
import org.springframework.security.kerberos.authentication.KerberosServiceAuthenticationProvider;
38-
import org.springframework.security.kerberos.authentication.KerberosServiceRequestToken;
39-
import org.springframework.security.kerberos.authentication.KerberosTicketValidation;
40-
import org.springframework.security.kerberos.authentication.KerberosTicketValidator;
4137

4238
import static org.assertj.core.api.Assertions.assertThatThrownBy;
4339
import static org.junit.jupiter.api.Assertions.assertEquals;

spring-security-kerberos-web/src/test/java/org/springframework/security/kerberos/docs/AuthProviderConfig.java

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015 the original author or authors.
2+
* Copyright 2015-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,37 +17,12 @@
1717

1818
import org.springframework.context.annotation.Bean;
1919
import org.springframework.context.annotation.Configuration;
20-
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
21-
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
22-
// import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
23-
// import org.springframework.security.config.annotation.web.servlet.configuration.EnableWebMvcSecurity;
2420
import org.springframework.security.kerberos.authentication.KerberosAuthenticationProvider;
2521
import org.springframework.security.kerberos.authentication.sun.SunJaasKerberosClient;
2622

2723
//tag::snippetA[]
2824
@Configuration
29-
// @EnableWebMvcSecurity
30-
public class AuthProviderConfig /*extends WebSecurityConfigurerAdapter*/ {
31-
32-
// @Override
33-
// protected void configure(HttpSecurity http) throws Exception {
34-
// http
35-
// .authorizeRequests()
36-
// .antMatchers("/", "/home").permitAll()
37-
// .anyRequest().authenticated()
38-
// .and()
39-
// .formLogin()
40-
// .loginPage("/login").permitAll()
41-
// .and()
42-
// .logout()
43-
// .permitAll();
44-
// }
45-
46-
// @Override
47-
// protected void configure(AuthenticationManagerBuilder auth) throws Exception {
48-
// auth
49-
// .authenticationProvider(kerberosAuthenticationProvider());
50-
// }
25+
public class AuthProviderConfig {
5126

5227
@Bean
5328
public KerberosAuthenticationProvider kerberosAuthenticationProvider() {

spring-security-kerberos-web/src/test/java/org/springframework/security/kerberos/docs/SpnegoConfig.java

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015 the original author or authors.
2+
* Copyright 2015-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,51 +19,16 @@
1919
import org.springframework.context.annotation.Configuration;
2020
import org.springframework.core.io.FileSystemResource;
2121
import org.springframework.security.authentication.AuthenticationManager;
22-
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
23-
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
24-
// import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
25-
// import org.springframework.security.config.annotation.web.servlet.configuration.EnableWebMvcSecurity;
2622
import org.springframework.security.kerberos.authentication.KerberosAuthenticationProvider;
2723
import org.springframework.security.kerberos.authentication.KerberosServiceAuthenticationProvider;
2824
import org.springframework.security.kerberos.authentication.sun.SunJaasKerberosClient;
2925
import org.springframework.security.kerberos.authentication.sun.SunJaasKerberosTicketValidator;
3026
import org.springframework.security.kerberos.web.authentication.SpnegoAuthenticationProcessingFilter;
3127
import org.springframework.security.kerberos.web.authentication.SpnegoEntryPoint;
32-
import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
3328

3429
//tag::snippetA[]
3530
@Configuration
36-
// @EnableWebMvcSecurity
37-
public class SpnegoConfig /*extends WebSecurityConfigurerAdapter*/ {
38-
39-
// @Override
40-
// protected void configure(HttpSecurity http) throws Exception {
41-
// http
42-
// .exceptionHandling()
43-
// .authenticationEntryPoint(spnegoEntryPoint())
44-
// .and()
45-
// .authorizeRequests()
46-
// .antMatchers("/", "/home").permitAll()
47-
// .anyRequest().authenticated()
48-
// .and()
49-
// .formLogin()
50-
// .loginPage("/login").permitAll()
51-
// .and()
52-
// .logout()
53-
// .permitAll()
54-
// .and()
55-
// .addFilterBefore(
56-
// spnegoAuthenticationProcessingFilter(authenticationManagerBean()),
57-
// BasicAuthenticationFilter.class);
58-
// }
59-
60-
// @Override
61-
// protected void configure(AuthenticationManagerBuilder auth)
62-
// throws Exception {
63-
// auth
64-
// .authenticationProvider(kerberosAuthenticationProvider())
65-
// .authenticationProvider(kerberosServiceAuthenticationProvider());
66-
// }
31+
public class SpnegoConfig {
6732

6833
@Bean
6934
public KerberosAuthenticationProvider kerberosAuthenticationProvider() {

spring-security-kerberos-web/src/test/java/org/springframework/security/kerberos/web/SpnegoAuthenticationProcessingFilterTest.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2015 the original author or authors.
2+
* Copyright 2009-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,11 +15,6 @@
1515
*/
1616
package org.springframework.security.kerberos.web;
1717

18-
import static org.mockito.Mockito.mock;
19-
import static org.mockito.Mockito.never;
20-
import static org.mockito.Mockito.verify;
21-
import static org.mockito.Mockito.when;
22-
2318
import java.io.IOException;
2419

2520
import jakarta.servlet.FilterChain;
@@ -31,7 +26,6 @@
3126
import org.junit.jupiter.api.AfterEach;
3227
import org.junit.jupiter.api.BeforeEach;
3328
import org.junit.jupiter.api.Test;
34-
import org.mockito.ArgumentMatchers;
3529

3630
import org.springframework.security.authentication.AnonymousAuthenticationToken;
3731
import org.springframework.security.authentication.AuthenticationManager;
@@ -51,6 +45,10 @@
5145
import static org.junit.jupiter.api.Assertions.assertEquals;
5246
import static org.mockito.ArgumentMatchers.any;
5347
import static org.mockito.ArgumentMatchers.anyInt;
48+
import static org.mockito.Mockito.mock;
49+
import static org.mockito.Mockito.never;
50+
import static org.mockito.Mockito.verify;
51+
import static org.mockito.Mockito.when;
5452

5553

5654
/**

0 commit comments

Comments
 (0)