src/share/classes/sun/net/www/protocol/http/BasicAuthentication.java
Print this page
@@ -129,42 +129,34 @@
}
/**
* @return true if this authentication supports preemptive authorization
*/
- boolean supportsPreemptiveAuthorization() {
+ @Override
+ public boolean supportsPreemptiveAuthorization() {
return true;
}
/**
- * @return the name of the HTTP header this authentication wants set
- */
- String getHeaderName() {
- if (type == SERVER_AUTHENTICATION) {
- return "Authorization";
- } else {
- return "Proxy-authorization";
- }
- }
-
- /**
* Set header(s) on the given connection. This will only be called for
* definitive (i.e. non-preemptive) authorization.
* @param conn The connection to apply the header(s) to
* @param p A source of header values for this connection, if needed.
* @param raw The raw header values for this connection, if needed.
* @return true if all goes well, false if no headers were set.
*/
- boolean setHeaders(HttpURLConnection conn, HeaderParser p, String raw) {
+ @Override
+ public boolean setHeaders(HttpURLConnection conn, HeaderParser p, String raw) {
conn.setAuthenticationProperty(getHeaderName(), getHeaderValue(null,null));
return true;
}
/**
* @return the value of the HTTP header this authentication wants set
*/
- String getHeaderValue(URL url, String method) {
+ @Override
+ public String getHeaderValue(URL url, String method) {
/* For Basic the authorization string does not depend on the request URL
* or the request method
*/
return auth;
}
@@ -172,11 +164,12 @@
/**
* For Basic Authentication, the security parameters can never be stale.
* In other words there is no possibility to reuse the credentials.
* They are always either valid or invalid.
*/
- boolean isAuthorizationStale (String header) {
+ @Override
+ public boolean isAuthorizationStale (String header) {
return false;
}
/**
* @return the common root path between npath and path.