Skip to content

Commit a7d2c70

Browse files
committed
fixed errors due to spring-5 version upgrade
1 parent f3beab5 commit a7d2c70

7 files changed

Lines changed: 18 additions & 18 deletions

File tree

httpclient-simple/src/main/java/com/baeldung/basic/MyBasicAuthenticationEntryPoint.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
package com.baeldung.basic;
22

3-
import org.springframework.security.core.AuthenticationException;
4-
import org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint;
5-
import org.springframework.stereotype.Component;
3+
import java.io.IOException;
4+
import java.io.PrintWriter;
65

7-
import javax.servlet.ServletException;
86
import javax.servlet.http.HttpServletRequest;
97
import javax.servlet.http.HttpServletResponse;
10-
import java.io.IOException;
11-
import java.io.PrintWriter;
8+
9+
import org.springframework.security.core.AuthenticationException;
10+
import org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint;
11+
import org.springframework.stereotype.Component;
1212

1313
@Component
1414
public class MyBasicAuthenticationEntryPoint extends BasicAuthenticationEntryPoint {
1515

1616
@Override
17-
public void commence(final HttpServletRequest request, final HttpServletResponse response, final AuthenticationException authException) throws IOException, ServletException {
17+
public void commence(final HttpServletRequest request, final HttpServletResponse response, final AuthenticationException authException) throws IOException {
1818
response.addHeader("WWW-Authenticate", "Basic realm=\"" + getRealmName() + "\"");
1919
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
2020
final PrintWriter writer = response.getWriter();
2121
writer.println("HTTP Status " + HttpServletResponse.SC_UNAUTHORIZED + " - " + authException.getMessage());
2222
}
2323

2424
@Override
25-
public void afterPropertiesSet() throws Exception {
25+
public void afterPropertiesSet() {
2626
setRealmName("Baeldung");
2727
super.afterPropertiesSet();
2828
}

spring-security-modules/spring-security-mvc-login/src/main/resources/RedirectionWebSecurityConfig.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
33
xsi:schemaLocation="
44
http://www.springframework.org/schema/security
5-
http://www.springframework.org/schema/security/spring-security-4.2.xsd
5+
https://www.springframework.org/schema/security/spring-security.xsd
66
http://www.springframework.org/schema/beans
7-
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd"
7+
https://www.springframework.org/schema/beans/spring-beans.xsd"
88
>
99
<http use-expressions="true">
1010
<intercept-url pattern="/login*" access="permitAll"/>

spring-security-modules/spring-security-mvc-login/src/main/resources/channelWebSecurityConfig.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
33
xsi:schemaLocation="
44
http://www.springframework.org/schema/security
5-
http://www.springframework.org/schema/security/spring-security-4.2.xsd
5+
https://www.springframework.org/schema/security/spring-security.xsd
66
http://www.springframework.org/schema/beans
7-
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd"
7+
https://www.springframework.org/schema/beans/spring-beans.xsd"
88
>
99

1010
<http use-expressions="true">

spring-security-modules/spring-security-mvc-login/src/main/resources/webSecurityConfig.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
33
xsi:schemaLocation="
44
http://www.springframework.org/schema/security
5-
http://www.springframework.org/schema/security/spring-security-4.2.xsd
5+
https://www.springframework.org/schema/security/spring-security.xsd
66
http://www.springframework.org/schema/beans
7-
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd"
7+
https://www.springframework.org/schema/beans/spring-beans.xsd"
88
>
99

1010
<http use-expressions="true">
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<beans xmlns="http://www.springframework.org/schema/beans"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd" >
4+
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd" >
55

66
</beans>

spring-security-modules/spring-security-mvc-login/src/test/resources/mvc-servlet.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<beans xmlns="http://www.springframework.org/schema/beans"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
4-
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
4+
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
55

66
<context:component-scan base-package="org.baeldung.controller" />
77

spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/basic/MyBasicAuthenticationEntryPoint.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
public class MyBasicAuthenticationEntryPoint extends BasicAuthenticationEntryPoint {
1515

1616
@Override
17-
public void commence(final HttpServletRequest request, final HttpServletResponse response, final AuthenticationException authException) throws IOException, ServletException {
17+
public void commence(final HttpServletRequest request, final HttpServletResponse response, final AuthenticationException authException) throws IOException {
1818
response.addHeader("WWW-Authenticate", "Basic realm=\"" + getRealmName() + "\"");
1919
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
2020
final PrintWriter writer = response.getWriter();
2121
writer.println("HTTP Status " + HttpServletResponse.SC_UNAUTHORIZED + " - " + authException.getMessage());
2222
}
2323

2424
@Override
25-
public void afterPropertiesSet() throws Exception {
25+
public void afterPropertiesSet() {
2626
setRealmName("Baeldung");
2727
super.afterPropertiesSet();
2828
}

0 commit comments

Comments
 (0)