本文整理了Java中org.apache.http.auth.AuthScope.match()
方法的一些代码示例,展示了AuthScope.match()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AuthScope.match()
方法的具体详情如下:
包路径:org.apache.http.auth.AuthScope
类名称:AuthScope
方法名:match
[英]Tests if the authentication scopes match.
[中]测试验证作用域是否匹配。
代码示例来源:origin: robovm/robovm
AuthScope bestMatch = null;
for (AuthScope current: map.keySet()) {
int factor = authscope.match(current);
if (factor > bestMatchFactor) {
bestMatchFactor = factor;
代码示例来源:origin: Unidata/thredds
static public AuthScope bestmatch(AuthScope scope, Set<AuthScope> scopelist)
{
Credentials creds = null;
int bestMatchFactor = -1;
AuthScope bestMatch = null;
for(final AuthScope current : scopelist) {
final int factor = scope.match(current);
if(factor > bestMatchFactor) {
bestMatchFactor = factor;
bestMatch = current;
}
}
return bestMatch;
}
代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.ecf.provider.filetransfer.httpclient4
private static Credentials matchCredentials(final Map<AuthScope, Credentials> map, final AuthScope authscope) {
// see if we get a direct hit
Credentials creds = map.get(authscope);
if (creds == null) {
// Nope.
// Do a full scan
int bestMatchFactor = -1;
AuthScope bestMatch = null;
for (AuthScope current : map.keySet()) {
int factor = authscope.match(current);
if (factor > bestMatchFactor) {
bestMatchFactor = factor;
bestMatch = current;
}
}
if (bestMatch != null) {
creds = map.get(bestMatch);
}
}
return creds;
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.ecf.provider.filetransfer.httpclient4
private static Credentials matchCredentials(final Map<AuthScope, Credentials> map, final AuthScope authscope) {
// see if we get a direct hit
Credentials creds = map.get(authscope);
if (creds == null) {
// Nope.
// Do a full scan
int bestMatchFactor = -1;
AuthScope bestMatch = null;
for (AuthScope current : map.keySet()) {
int factor = authscope.match(current);
if (factor > bestMatchFactor) {
bestMatchFactor = factor;
bestMatch = current;
}
}
if (bestMatch != null) {
creds = map.get(bestMatch);
}
}
return creds;
}
代码示例来源:origin: com.bugvm/bugvm-rt
AuthScope bestMatch = null;
for (final AuthScope current: map.keySet()) {
final int factor = authscope.match(current);
if (factor > bestMatchFactor) {
bestMatchFactor = factor;
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient
AuthScope bestMatch = null;
for (final AuthScope current: map.keySet()) {
final int factor = authscope.match(current);
if (factor > bestMatchFactor) {
bestMatchFactor = factor;
代码示例来源:origin: Nextdoor/bender
AuthScope bestMatch = null;
for (final AuthScope current: map.keySet()) {
final int factor = authscope.match(current);
if (factor > bestMatchFactor) {
bestMatchFactor = factor;
代码示例来源:origin: com.gluonhq/robovm-rt
AuthScope bestMatch = null;
for (AuthScope current: map.keySet()) {
int factor = authscope.match(current);
if (factor > bestMatchFactor) {
bestMatchFactor = factor;
代码示例来源:origin: ibinti/bugvm
AuthScope bestMatch = null;
for (final AuthScope current: map.keySet()) {
final int factor = authscope.match(current);
if (factor > bestMatchFactor) {
bestMatchFactor = factor;
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
AuthScope bestMatch = null;
for (final AuthScope current: map.keySet()) {
final int factor = authscope.match(current);
if (factor > bestMatchFactor) {
bestMatchFactor = factor;
代码示例来源:origin: MobiVM/robovm
AuthScope bestMatch = null;
for (AuthScope current: map.keySet()) {
int factor = authscope.match(current);
if (factor > bestMatchFactor) {
bestMatchFactor = factor;
代码示例来源:origin: org.apache.httpcomponents/httpclient-android
AuthScope bestMatch = null;
for (final AuthScope current: map.keySet()) {
final int factor = authscope.match(current);
if (factor > bestMatchFactor) {
bestMatchFactor = factor;
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
AuthScope bestMatch = null;
for (AuthScope current: map.keySet()) {
int factor = authscope.match(current);
if (factor > bestMatchFactor) {
bestMatchFactor = factor;
代码示例来源:origin: com.hynnet/httpclient
AuthScope bestMatch = null;
for (final AuthScope current: map.keySet()) {
final int factor = authscope.match(current);
if (factor > bestMatchFactor) {
bestMatchFactor = factor;
代码示例来源:origin: HtmlUnit/htmlunit
/**
* Removes the credentials from the AuthScope.
* @param authscope the AuthScope to remove the credentials of
* @return whether it was removed or not
*/
public synchronized boolean removeCredentials(final AuthScope authscope) {
if (authscope == null) {
throw new IllegalArgumentException("Authentication scope may not be null");
}
int bestMatchFactor = -1;
AuthScopeProxy bestMatch = null;
for (final AuthScopeProxy proxy : credentialsMap_.keySet()) {
final AuthScope current = proxy.getAuthScope();
final int factor = authscope.match(current);
if (factor > bestMatchFactor) {
bestMatchFactor = factor;
bestMatch = proxy;
}
}
return credentialsMap_.remove(bestMatch) != null;
}
代码示例来源:origin: org.eclipse.aether/aether-transport-http
public Credentials getCredentials( AuthScope authScope )
{
synchronized ( factories )
{
for ( Iterator<Map.Entry<AuthScope, Factory>> it = factories.entrySet().iterator(); it.hasNext(); )
{
Map.Entry<AuthScope, Factory> entry = it.next();
if ( authScope.match( entry.getKey() ) >= 0 )
{
it.remove();
delegate.setCredentials( entry.getKey(), entry.getValue().newCredentials() );
}
}
}
return delegate.getCredentials( authScope );
}
代码示例来源:origin: net.sourceforge.htmlunit/htmlunit
/**
* Removes the credentials from the AuthScope.
* @param authscope the AuthScope to remove the credentials of
* @return whether it was removed or not
*/
public synchronized boolean removeCredentials(final AuthScope authscope) {
if (authscope == null) {
throw new IllegalArgumentException("Authentication scope may not be null");
}
int bestMatchFactor = -1;
AuthScopeProxy bestMatch = null;
for (final AuthScopeProxy proxy : credentialsMap_.keySet()) {
final AuthScope current = proxy.getAuthScope();
final int factor = authscope.match(current);
if (factor > bestMatchFactor) {
bestMatchFactor = factor;
bestMatch = proxy;
}
}
return credentialsMap_.remove(bestMatch) != null;
}
代码示例来源:origin: org.apache.httpcomponents/httpclient-osgi
private boolean isSuitable(final ProxyConfiguration config, final AuthScope authScope) {
return authScope.match(new AuthScope(config.getHostname(), config.getPort())) >= HOST_AND_PORT_MATCH;
}
代码示例来源:origin: HtmlUnit/htmlunit
/**
* Find matching {@link Credentials credentials} for the given authentication scope.
*
* @param map the credentials hash map
* @param authscope the {@link AuthScope authentication scope}
* @return the credentials
*/
private static Credentials matchCredentials(final Map<AuthScopeProxy, Credentials> map, final AuthScope authscope) {
Credentials creds = map.get(new AuthScopeProxy(authscope));
if (creds == null) {
int bestMatchFactor = -1;
AuthScopeProxy bestMatch = null;
for (final AuthScopeProxy proxy : map.keySet()) {
final AuthScope current = proxy.getAuthScope();
final int factor = authscope.match(current);
if (factor > bestMatchFactor) {
bestMatchFactor = factor;
bestMatch = proxy;
}
}
if (bestMatch != null) {
creds = map.get(bestMatch);
}
}
return creds;
}
代码示例来源:origin: net.sourceforge.htmlunit/htmlunit
for (final AuthScopeProxy proxy : map.keySet()) {
final AuthScope current = proxy.getAuthScope();
final int factor = authscope.match(current);
if (factor > bestMatchFactor) {
bestMatchFactor = factor;
内容来源于网络,如有侵权,请联系作者删除!