/** * @deprecated Use {@link #authenticate(BearerCredentials, String)} * * Returns a bearer Authorization header value for the given * {@link BearerCredentials}. * * @param credentials The credentials to encode. * * @return A bearer authorization string */ public static String authenticate(BearerCredentials credentials) { return authenticate(credentials, "ISO-8859-1"); }
/** * Produces bearer authorization string for the given set of * {@link Credentials}. * * @param credentials The set of credentials to be used for authentication * @param method Method name is ignored by the bearer authentication scheme * @param uri URI is ignored by the bearer authentication scheme * @throws InvalidCredentialsException If authentication credentials are not valid or not applicable * for this authentication scheme * @throws AuthenticationException If authorization string cannot be generated due to an authentication failure * @return A bearer authorization string * * @deprecated Use {@link #authenticate(Credentials, HttpMethod)} */ public String authenticate(Credentials credentials, String method, String uri) throws AuthenticationException { Log_OC.d(TAG, "enter BearerScheme.authenticate(Credentials, String, String)"); BearerCredentials bearer = null; try { bearer = (BearerCredentials) credentials; } catch (ClassCastException e) { throw new InvalidCredentialsException( "Credentials cannot be used for bearer authentication: " + credentials.getClass().getName()); } return BearerAuthScheme.authenticate(bearer); }
/** * Produces bearer authorization string for the given set of {@link Credentials}. * * @param credentials The set of credentials to be used for authentication * @param method The method being authenticated * @throws InvalidCredentialsException If authentication credentials are not valid or not applicable for this authentication * scheme. * @throws AuthenticationException If authorization string cannot be generated due to an authentication failure. * * @return a basic authorization string */ public String authenticate(Credentials credentials, HttpMethod method) throws AuthenticationException { Log_OC.d(TAG, "enter BearerScheme.authenticate(Credentials, HttpMethod)"); if (method == null) { throw new IllegalArgumentException("Method may not be null"); } BearerCredentials bearer = null; try { bearer = (BearerCredentials) credentials; } catch (ClassCastException e) { throw new InvalidCredentialsException( "Credentials cannot be used for bearer authentication: " + credentials.getClass().getName()); } return BearerAuthScheme.authenticate( bearer, method.getParams().getCredentialCharset()); }