version 1.4, 2000/08/16 21:37:33
|
version 1.5, 2005/02/18 17:35:13
|
Line 16 import org.w3c.www.http.HttpCredential;
|
Line 16 import org.w3c.www.http.HttpCredential;
|
*/ |
*/ |
public class BasicAuthPrincipal extends HTTPPrincipal { |
public class BasicAuthPrincipal extends HTTPPrincipal { |
|
|
|
// original name is there to cope with a MS weirdness on MiniRedir |
|
protected String origname = null; |
protected String name = null; |
protected String name = null; |
protected String password = null; |
protected String password = null; |
protected String cookie = null; |
protected String cookie = null; |
Line 61 public class BasicAuthPrincipal extends
|
Line 63 public class BasicAuthPrincipal extends
|
return name; |
return name; |
} |
} |
|
|
|
public String getOriginalName() { |
|
return (origname == null) ? name : origname; |
|
} |
|
|
public BasicAuthPrincipal(Request request) |
public BasicAuthPrincipal(Request request) |
throws InvalidAuthException |
throws InvalidAuthException |
{ |
{ |
super(request); |
this(request, false); |
|
} |
|
|
|
public BasicAuthPrincipal(Request request, boolean lenient) |
|
throws InvalidAuthException |
|
{ |
|
super(request, lenient); |
HttpCredential credential = null; |
HttpCredential credential = null; |
credential = (request.isProxy() |
credential = (request.isProxy() |
? request.getProxyAuthorization() |
? request.getProxyAuthorization() |
Line 89 public class BasicAuthPrincipal extends
|
Line 101 public class BasicAuthPrincipal extends
|
throw new InvalidAuthException (msg) ; |
throw new InvalidAuthException (msg) ; |
} |
} |
// Get user and password: |
// Get user and password: |
|
origname = null; |
int icolon = decoded.indexOf (':') ; |
int icolon = decoded.indexOf (':') ; |
if ( (icolon > 0) && (icolon+1 < decoded.length()) ) { |
if ( (icolon > 0) && (icolon+1 < decoded.length()) ) { |
// ok, parse was find, check user: |
// ok, parse was find, check user: |
this.name = decoded.substring (0, icolon) ; |
if (lenient) { |
|
String _name = decoded.substring (0, icolon) ; |
|
int _slashIdx = _name.lastIndexOf('\\'); |
|
if ( _slashIdx != -1) { |
|
this.origname = _name; |
|
this.name = _name.substring(_slashIdx+1); |
|
} else { |
|
this.name = _name; |
|
} |
|
} else { |
|
this.name = decoded.substring (0, icolon) ; |
|
} |
this.password = decoded.substring (icolon+1) ; |
this.password = decoded.substring (icolon+1) ; |
} else { |
} else { |
String msg = "Invalid credentials syntax in " + decoded ; |
String msg = "Invalid credentials syntax in " + decoded ; |
Line 100 public class BasicAuthPrincipal extends
|
Line 124 public class BasicAuthPrincipal extends
|
} |
} |
} |
} |
} |
} |
|
|
} |
} |