1
0
mirror of synced 2026-05-22 21:33:16 +00:00
Issue gh-9310
This commit is contained in:
Han YanJing
2021-02-27 16:43:35 +08:00
committed by Josh Cummings
parent 6e41246a2b
commit f3fa8e8800
3 changed files with 10 additions and 37 deletions
@@ -17,7 +17,6 @@
package org.springframework.security.saml2.provider.service.web;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.zip.Inflater;
import java.util.zip.InflaterOutputStream;
@@ -84,9 +83,9 @@ public final class Saml2AuthenticationTokenConverter implements AuthenticationCo
return new String(b, StandardCharsets.UTF_8);
}
private byte[] samlDecode(String s) {
private byte[] samlDecode(String base64EncodedPayload) {
try {
return BASE64.decode(s);
return BASE64.decode(base64EncodedPayload);
}
catch (Exception ex) {
throw new Saml2AuthenticationException(
@@ -100,7 +99,7 @@ public final class Saml2AuthenticationTokenConverter implements AuthenticationCo
InflaterOutputStream inflaterOutputStream = new InflaterOutputStream(out, new Inflater(true));
inflaterOutputStream.write(b);
inflaterOutputStream.finish();
return new String(out.toByteArray(), StandardCharsets.UTF_8);
return out.toString(StandardCharsets.UTF_8.name());
}
catch (Exception ex) {
throw new Saml2AuthenticationException(
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -63,7 +63,7 @@ public final class Saml2Utils {
InflaterOutputStream inflaterOutputStream = new InflaterOutputStream(out, new Inflater(true));
inflaterOutputStream.write(b);
inflaterOutputStream.finish();
return new String(out.toByteArray(), StandardCharsets.UTF_8);
return out.toString(StandardCharsets.UTF_8.name());
}
catch (IOException ex) {
throw new Saml2Exception("Unable to inflate string", ex);