Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  *      Copyright (C) 2012 DataStax Inc.
  *   Licensed under the Apache License, Version 2.0 (the "License");
  *   you may not use this file except in compliance with the License.
  *   You may obtain a copy of the License at
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
package com.datastax.driver.core;
Authentication information provider to connect to Cassandra nodes.

The authentication information consists of key-value pairs. Which exact key-value pairs are required depends on the authenticator set for the Cassandra nodes.

// NOTE: we don't expose that yet, this will change to something better
abstract class AuthInfoProvider {

A provider that provides no authentication information.

This is only useful for when no authentication is to be used.

    static final AuthInfoProvider NONE = new AuthInfoProvider() {
        public Map<StringStringgetAuthInfo(InetAddress host) {
            return Collections.<StringString>emptyMap();

The authentication information to use to connect to host. Please note that if authentication is required, this method will be called to initialize each new connection created by the driver. It is thus a good idea to make sure this method returns relatively quickly.

host the Cassandra host for which authentication information is requested.
The authentication informations to use.
    public abstract Map<StringStringgetAuthInfo(InetAddress host);
    static class Simple extends AuthInfoProvider {
        private static final String USERNAME_KEY = "username";
        private static final String PASSWORD_KEY = "password";
        private final Map<StringStringcredentials = new HashMap<StringString>(2);
        Simple(String usernameString password) {
        public Map<StringStringgetAuthInfo(InetAddress host) {
            return ;
New to GrepCode? Check out our FAQ X