mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-15 04:52:09 +08:00
optimize
This commit is contained in:
@@ -31,7 +31,8 @@ public class HttpsTrusts {
|
||||
sc.init(null, trustAllCerts, null);
|
||||
javax.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
|
||||
}
|
||||
/*
|
||||
|
||||
/**
|
||||
* https ssl auto trust
|
||||
*/
|
||||
public static void beforeConnection() {
|
||||
|
||||
@@ -20,7 +20,6 @@ package org.maxkey.util;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.maxkey.client.oauth.model.OAuthConstants;
|
||||
|
||||
/**
|
||||
* Utils for checking preconditions and invariants
|
||||
@@ -31,6 +30,8 @@ public abstract class Preconditions {
|
||||
|
||||
// scheme = alpha *( alpha | digit | "+" | "-" | "." )
|
||||
private static final String URL_REGEXP = "^[a-zA-Z][a-zA-Z0-9+.-]*://\\S+";
|
||||
|
||||
private static final String OUT_OF_BAND = "oob";
|
||||
|
||||
/**
|
||||
* Checks that an object is not null.
|
||||
@@ -75,7 +76,7 @@ public abstract class Preconditions {
|
||||
*/
|
||||
public static void checkValidOAuthCallback(String url, String errorMsg) {
|
||||
checkEmptyString(url, errorMsg);
|
||||
if (url.toLowerCase(Locale.getDefault()).compareToIgnoreCase(OAuthConstants.OUT_OF_BAND) != 0) {
|
||||
if (url.toLowerCase(Locale.getDefault()).compareToIgnoreCase(OUT_OF_BAND) != 0) {
|
||||
check(isUrl(url), errorMsg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,8 @@ package org.maxkey.util;
|
||||
import java.security.Provider;
|
||||
import java.security.Security;
|
||||
|
||||
import org.maxkey.client.crypto.ReciprocalUtils;
|
||||
import org.maxkey.crypto.password.PasswordReciprocal;
|
||||
|
||||
|
||||
public class InstanceTest {
|
||||
|
||||
@@ -28,9 +29,9 @@ public class InstanceTest {
|
||||
if(System.getProperty("java.version").startsWith("1.8")) {
|
||||
System.out.println("1.8");
|
||||
Security.addProvider((Provider)Instance.newInstance("com.sun.crypto.provider.SunJCE"));
|
||||
System.out.println(ReciprocalUtils.encode("ddddd"));
|
||||
System.out.println(PasswordReciprocal.getInstance().encode("ddddd"));
|
||||
|
||||
System.out.println(ReciprocalUtils.encode("ddfs"));
|
||||
System.out.println(PasswordReciprocal.getInstance().encode("ddfs"));
|
||||
}else {
|
||||
System.out.println("other");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user