Skip to content

Commit 26aca85

Browse files
committed
spring-projectsgh-9310: Cleanup code
1 parent 6ecff6b commit 26aca85

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

config/src/test/java/org/springframework/security/config/annotation/web/configurers/saml2/Saml2LoginConfigurerTests.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.io.IOException;
2020
import java.net.URLDecoder;
2121
import java.time.Duration;
22-
import java.util.Arrays;
2322
import java.util.Base64;
2423
import java.util.Collection;
2524
import java.util.Collections;
@@ -107,10 +106,10 @@
107106
public class Saml2LoginConfigurerTests {
108107

109108
private static final Converter<Assertion, Collection<? extends GrantedAuthority>> AUTHORITIES_EXTRACTOR = (
110-
a) -> Arrays.asList(new SimpleGrantedAuthority("TEST"));
109+
a) -> Collections.singletonList(new SimpleGrantedAuthority("TEST"));
111110

112-
private static final GrantedAuthoritiesMapper AUTHORITIES_MAPPER = (authorities) -> Arrays
113-
.asList(new SimpleGrantedAuthority("TEST CONVERTED"));
111+
private static final GrantedAuthoritiesMapper AUTHORITIES_MAPPER = (authorities) -> Collections
112+
.singletonList(new SimpleGrantedAuthority("TEST CONVERTED"));
114113

115114
private static final Duration RESPONSE_TIME_VALIDATION_SKEW = Duration.ZERO;
116115

saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/web/Saml2AuthenticationTokenConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private String samlInflate(byte[] b) {
100100
InflaterOutputStream inflaterOutputStream = new InflaterOutputStream(out, new Inflater(true));
101101
inflaterOutputStream.write(b);
102102
inflaterOutputStream.finish();
103-
return new String(out.toByteArray(), StandardCharsets.UTF_8);
103+
return out.toString(StandardCharsets.UTF_8.name());
104104
}
105105
catch (IOException ex) {
106106
throw new Saml2AuthenticationException(

saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/Saml2Utils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static String samlInflate(byte[] b) {
6565
InflaterOutputStream inflaterOutputStream = new InflaterOutputStream(out, new Inflater(true));
6666
inflaterOutputStream.write(b);
6767
inflaterOutputStream.finish();
68-
return new String(out.toByteArray(), StandardCharsets.UTF_8);
68+
return out.toString(StandardCharsets.UTF_8.name());
6969
}
7070
catch (IOException ex) {
7171
throw new Saml2Exception("Unable to inflate string", ex);

0 commit comments

Comments
 (0)