forked from loafle/openapi-generator-original
[Java][jersey2] Fix format of Date header in HTTP signature (#6925)
* Use RFC 1123 date format for Date header in HTTP signature * Use RFC 1123 date format for Date header in HTTP signature
This commit is contained in:
parent
9d76ca291e
commit
38368c9bda
@ -12,10 +12,12 @@ import java.security.Key;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
import java.security.spec.AlgorithmParameterSpec;
|
||||
import java.security.InvalidKeyException;
|
||||
|
||||
@ -236,7 +238,9 @@ public class HttpSignatureAuth implements Authentication {
|
||||
}
|
||||
|
||||
if (headers.contains("date")) {
|
||||
headerParams.put("date", new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US).format(new Date()));
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
|
||||
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
headerParams.put("date", dateFormat.format(Calendar.getInstance().getTime()));
|
||||
}
|
||||
|
||||
if (headers.contains("digest")) {
|
||||
|
@ -23,10 +23,12 @@ import java.security.Key;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
import java.security.spec.AlgorithmParameterSpec;
|
||||
import java.security.InvalidKeyException;
|
||||
|
||||
@ -247,7 +249,9 @@ public class HttpSignatureAuth implements Authentication {
|
||||
}
|
||||
|
||||
if (headers.contains("date")) {
|
||||
headerParams.put("date", new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US).format(new Date()));
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
|
||||
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
headerParams.put("date", dateFormat.format(Calendar.getInstance().getTime()));
|
||||
}
|
||||
|
||||
if (headers.contains("digest")) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user