/** * Creates a copy of the given credentials scope. */ public AuthScope(final AuthScope authscope) { super(); if (authscope == null) { throw new IllegalArgumentException("Scope may not be null"); } this.host = authscope.getHost(); this.port = authscope.getPort(); this.realm = authscope.getRealm(); this.scheme = authscope.getScheme(); }
private void writeObject(final ObjectOutputStream stream) throws IOException { stream.writeObject(authScope_.getHost()); stream.writeInt(authScope_.getPort()); stream.writeObject(authScope_.getRealm()); stream.writeObject(authScope_.getScheme()); } private void readObject(final ObjectInputStream stream) throws IOException, ClassNotFoundException {
private void writeObject(final ObjectOutputStream stream) throws IOException { stream.writeObject(authScope_.getHost()); stream.writeInt(authScope_.getPort()); stream.writeObject(authScope_.getRealm()); stream.writeObject(authScope_.getScheme()); }
static public void serializeScope(AuthScope scope, ObjectOutputStream oos) throws IOException { oos.writeObject(scope.getHost()); oos.writeInt(scope.getPort()); oos.writeObject(scope.getRealm()); oos.writeObject(scope.getScheme()); }
/** * Basic setter */ private void setAuthScope(AuthScope authScope) { this.authScope = authScope; log.info("Host=\"" + authScope.getHost() + "\""); log.info("Port=\"" + authScope.getPort() + "\""); log.info("Realm=\"" + authScope.getRealm() + "\""); log.info("Scheme=\"" + authScope.getScheme() + "\""); }
/** * Creates a copy of the given credentials scope. */ public AuthScope(final AuthScope authscope) { super(); if (authscope == null) { throw new IllegalArgumentException("Scope may not be null"); } this.host = authscope.getHost(); this.port = authscope.getPort(); this.realm = authscope.getRealm(); this.scheme = authscope.getScheme(); }
/** * Creates a copy of the given credentials scope. */ public AuthScope(final AuthScope authscope) { super(); if (authscope == null) { throw new IllegalArgumentException("Scope may not be null"); } this.host = authscope.getHost(); this.port = authscope.getPort(); this.realm = authscope.getRealm(); this.scheme = authscope.getScheme(); }
/** * Creates a copy of the given credentials scope. */ public AuthScope(final AuthScope authscope) { super(); if (authscope == null) { throw new IllegalArgumentException("Scope may not be null"); } this.host = authscope.getHost(); this.port = authscope.getPort(); this.realm = authscope.getRealm(); this.scheme = authscope.getScheme(); }
/** * Creates a copy of the given credentials scope. */ public AuthScope(final AuthScope authscope) { super(); if (authscope == null) { throw new IllegalArgumentException("Scope may not be null"); } this.host = authscope.getHost(); this.port = authscope.getPort(); this.realm = authscope.getRealm(); this.scheme = authscope.getScheme(); }
/** * Equivalence algorithm: * if any field is ANY_XXX, then they are equivalent. * Scheme, port, host must all be identical else return false * If this.path is prefix of other.path * or other.path is prefix of this.path * or they are string equals, then return true * else return false. */ static public boolean equivalent(AuthScope a1, AuthScope a2) { if(a1 == null || a2 == null) throw new NullPointerException(); if(a1.getScheme() != ANY_SCHEME && a2.getScheme() != ANY_SCHEME && !a1.getScheme().equals(a2.getScheme())) return false; if(a1.getHost() != ANY_HOST && a2.getHost() != ANY_HOST && !a1.getHost().equals(a2.getHost())) return false; if(a1.getPort() != ANY_PORT && a2.getPort() != ANY_PORT && a1.getPort() != a2.getPort()) return false; if(a1.getRealm() != ANY_REALM && a2.getRealm() != ANY_REALM && !a1.getRealm().equals(a2.getRealm())) return false; return true; }
/** * Creates a copy of the given credentials scope. */ public AuthScope(final AuthScope authscope) { super(); Args.notNull(authscope, "Scope"); this.host = authscope.getHost(); this.port = authscope.getPort(); this.realm = authscope.getRealm(); this.scheme = authscope.getScheme(); }
/** * Creates a copy of the given credentials scope. */ public AuthScope(final AuthScope authscope) { super(); Args.notNull(authscope, "Scope"); this.host = authscope.getHost(); this.port = authscope.getPort(); this.realm = authscope.getRealm(); this.scheme = authscope.getScheme(); this.origin = authscope.getOrigin(); }
/** * Creates a copy of the given credentials scope. */ public AuthScope(final AuthScope authscope) { super(); Args.notNull(authscope, "Scope"); this.host = authscope.getHost(); this.port = authscope.getPort(); this.realm = authscope.getRealm(); this.scheme = authscope.getScheme(); this.origin = authscope.getOrigin(); }
/** * Creates a copy of the given credentials scope. */ public AuthScope(final AuthScope authscope) { super(); Args.notNull(authscope, "Scope"); this.host = authscope.getHost(); this.port = authscope.getPort(); this.realm = authscope.getRealm(); this.scheme = authscope.getScheme(); this.origin = authscope.getOrigin(); }
/** * Creates a copy of the given credentials scope. */ public AuthScope(final AuthScope authscope) { super(); Args.notNull(authscope, "Scope"); this.host = authscope.getHost(); this.port = authscope.getPort(); this.realm = authscope.getRealm(); this.scheme = authscope.getScheme(); this.origin = authscope.getOrigin(); }
/** * Creates a copy of the given credentials scope. */ public AuthScope(final AuthScope authscope) { super(); Args.notNull(authscope, "Scope"); this.host = authscope.getHost(); this.port = authscope.getPort(); this.realm = authscope.getRealm(); this.scheme = authscope.getScheme(); this.origin = authscope.getOrigin(); }
@Override public Credentials getCredentials(final AuthScope authScope) { for (final HttpClientAuthProvider authProvider : authProviders) { if (authProvider.acceptRequest(authScope.getScheme(), authScope.getHost(), authScope.getPort(), authScope.getRealm())) { return new Credentials() { @Override public Principal getUserPrincipal() { return new BasicUserPrincipal(authProvider.getUser()); } @Override public String getPassword() { return authProvider.getPassword(); } }; } } return null; }
public int hashCode() { if (myScope == null) { return 0; } return myScope.getPort() + ComparisonUtil.hashCode(myScope.getHost()) + ComparisonUtil.hashCode(myScope.getScheme()) + ComparisonUtil.hashCode(myScope.getRealm()); } }
public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof AuthScopeKey)) { return false; } final AuthScope scope = ((AuthScopeKey)obj).myScope; if (myScope == null) { return scope == null; } if (scope == null) { return false; } return myScope.getPort() == scope.getPort() && ComparisonUtil.equal(myScope.getHost(), scope.getHost()) && ComparisonUtil.equal(myScope.getScheme(), scope.getScheme()) && ComparisonUtil.equal(myScope.getRealm(), scope.getRealm()); }
public static boolean identical(AuthScope a1, AuthScope a2) { if(a2 == null ^ a1 == null) return false; if(a1 == a2) return true; // So it turns out that AuthScope#equals does not // test port values correctly, so we need to fix here. if(true) { boolean b1 = LangUtils.equals(a1.getHost(), a2.getHost()); int aport = a2.getPort(); boolean b2 = (a1.getPort() == aport || a1.getPort() == ANY_PORT || aport == ANY_PORT); boolean b3 = LangUtils.equals(a1.getRealm(), a2.getRealm()); boolean b4 = LangUtils.equals(a1.getScheme(), a2.getScheme()); if(!(b1 && b2 && b3 && b4)) return false; } else if(!a1.equals(a2)) return false; return true; }