Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add url List to authorizationValue #3995

Merged
merged 1 commit into from
Aug 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
package io.swagger.models.auth;

import java.net.URL;
import java.util.Objects;

public class AuthorizationValue {
private String value, type, keyName;
private UrlMatcher urlMatcher;

public AuthorizationValue() {
}

public AuthorizationValue(String keyName, String value, String type) {
public AuthorizationValue(String keyName, String value, String type, UrlMatcher urlMatcher) {
this.setKeyName(keyName);
this.setValue(value);
this.setType(type);
this.setUrlMatcher(urlMatcher);
}

public AuthorizationValue(String keyName, String value, String type) {
this(keyName, value, type, new UrlMatcher() {
@Override
public boolean test(URL url) {
return true;
}
});
}

public AuthorizationValue value(String value) {
Expand All @@ -27,6 +41,11 @@ public AuthorizationValue keyName(String keyName) {
return this;
}

public AuthorizationValue urlMatcher(UrlMatcher urlMatcher) {
setUrlMatcher(urlMatcher);
return this;
}

public String getValue() {
return value;
}
Expand All @@ -51,13 +70,21 @@ public void setKeyName(String keyName) {
this.keyName = keyName;
}

public UrlMatcher getUrlMatcher() {
return urlMatcher;
}
public void setUrlMatcher(UrlMatcher urlMatcher) {
this.urlMatcher = Objects.requireNonNull(urlMatcher);
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((keyName == null) ? 0 : keyName.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
result = prime * result + ((urlMatcher == null) ? 0 : urlMatcher.hashCode());
return result;
}

Expand Down Expand Up @@ -94,6 +121,15 @@ public boolean equals(Object obj) {
} else if (!value.equals(other.value)) {
return false;
}
if (urlMatcher == null) {
if (other.urlMatcher != null) {
return false;
}
} else if (!urlMatcher.equals(other.urlMatcher)) {
if (!urlMatcher.equals(other.urlMatcher)) {
return false;
}
}
return true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package io.swagger.models.auth;

import java.net.URL;

public interface UrlMatcher {
boolean test(URL url);
}