今天看源码,看到两个URL对比比较有意思,记录一下。
源码在
org.springframework.security.oauth2.provider.endpoint.DefaultRedirectResolver
import org.springframework.util.StringUtils;
import java.net.MalformedURLException;
import java.net.URL;
public class DefaultRedirectResolver implements RedirectResolver {
private boolean matchSubdomains = true;
private boolean matchPorts = true;
protected boolean redirectMatches(String requestedRedirect, String redirectUri) {
try {
URL req = new URL(requestedRedirect);
URL reg = new URL(redirectUri);
int requestedPort = req.getPort() != -1 ? req.getPort() : req.getDefaultPort();
int registeredPort = reg.getPort() != -1 ? reg.getPort() : reg.getDefaultPort();
boolean portsMatch = this.matchPorts ? registeredPort == requestedPort : true;
if (reg.getProtocol().equ