accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [2/3] git commit: Merge branch '1.4.5-SNAPSHOT' into 1.5.1-SNAPSHOT
Date Fri, 15 Nov 2013 02:56:32 GMT
Merge branch '1.4.5-SNAPSHOT' into 1.5.1-SNAPSHOT

Conflicts:
	core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/ac20fe06
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/ac20fe06
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/ac20fe06

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: ac20fe06cf7627bc7f25d455d4bff7b4fa057a34
Parents: 7551b55 268028f
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Thu Nov 14 21:51:29 2013 -0500
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Thu Nov 14 21:51:29 2013 -0500

----------------------------------------------------------------------
 .../org/apache/accumulo/core/client/AccumuloSecurityException.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/ac20fe06/core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java
index 890db36,0000000..ea73640
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/AccumuloSecurityException.java
@@@ -1,135 -1,0 +1,135 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one or more
 + * contributor license agreements.  See the NOTICE file distributed with
 + * this work for additional information regarding copyright ownership.
 + * The ASF licenses this file to You 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
 + *
 + *     http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * 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 org.apache.accumulo.core.client;
 +
 +import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode;
 +import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
 +
 +/**
 + * An Accumulo Exception for security violations, authentication failures, authorization
failures, etc.
 + * 
 + */
 +public class AccumuloSecurityException extends Exception {
 +  private static final long serialVersionUID = 1L;
 +
 +  private static String getDefaultErrorMessage(final SecurityErrorCode errorcode) {
-     switch (errorcode) {
++    switch (errorcode == null ? SecurityErrorCode.DEFAULT_SECURITY_ERROR : errorcode) {
 +      case BAD_CREDENTIALS:
 +        return "Username or Password is Invalid";
 +      case CONNECTION_ERROR:
 +        return "Connection Error Occurred";
 +      case PERMISSION_DENIED:
 +        return "User does not have permission to perform this action";
 +      case USER_DOESNT_EXIST:
 +        return "The user does not exist";
 +      case USER_EXISTS:
 +        return "The user exists";
 +      case GRANT_INVALID:
 +        return "The GRANT permission cannot be granted or revoked";
 +      case BAD_AUTHORIZATIONS:
 +        return "The user does not have the specified authorizations assigned";
 +      case UNSUPPORTED_OPERATION:
 +        return "The configured security handler does not support this operation";
 +      case INVALID_TOKEN:
 +        return "The configured authenticator does not accept this type of token";
 +      case AUTHENTICATOR_FAILED:
 +        return "The configured authenticator failed for some reason";
 +      case AUTHORIZOR_FAILED:
 +        return "The configured authorizor failed for some reason";
 +      case PERMISSIONHANDLER_FAILED:
 +        return "The configured permission handler failed for some reason";
 +      case TOKEN_EXPIRED:
 +        return "The supplied token expired, please update and try again";
 +      case INSUFFICIENT_PROPERTIES:
 +        return "The login properties supplied are not sufficient for authentication. Please
check the requested properties and try again";
 +      case DEFAULT_SECURITY_ERROR:
 +      default:
 +        return "Unknown security exception";
 +    }
 +  }
 +
 +  private String user;
 +  private SecurityErrorCode errorCode;
 +
 +  /**
 +   * @return this exception as a thrift exception
 +   */
 +  public ThriftSecurityException asThriftException() {
 +    return new ThriftSecurityException(user, errorCode);
 +  }
 +
 +  /**
 +   * @param user
 +   *          the relevant user for the security violation
 +   * @param errorcode
 +   *          the specific reason for this exception
 +   * @param cause
 +   *          the exception that caused this violation
 +   */
 +  public AccumuloSecurityException(final String user, final SecurityErrorCode errorcode,
final Throwable cause) {
 +    super(getDefaultErrorMessage(errorcode), cause);
 +    this.user = user;
 +    this.errorCode = errorcode == null ? SecurityErrorCode.DEFAULT_SECURITY_ERROR : errorcode;
 +  }
 +
 +  /**
 +   * @param user
 +   *          the relevant user for the security violation
 +   * @param errorcode
 +   *          the specific reason for this exception
 +   */
 +  public AccumuloSecurityException(final String user, final SecurityErrorCode errorcode)
{
 +    super(getDefaultErrorMessage(errorcode));
 +    this.user = user;
 +    this.errorCode = errorcode == null ? SecurityErrorCode.DEFAULT_SECURITY_ERROR : errorcode;
 +  }
 +
 +  /**
 +   * @return the relevant user for the security violation
 +   */
 +  public String getUser() {
 +    return user;
 +  }
 +
 +  public void setUser(String s) {
 +    this.user = s;
 +  }
 +
 +  /**
 +   * @return the specific reason for this exception
 +   * @since 1.5.0
 +   */
 +
 +  public org.apache.accumulo.core.client.security.SecurityErrorCode getSecurityErrorCode()
{
 +    return org.apache.accumulo.core.client.security.SecurityErrorCode.valueOf(errorCode.name());
 +  }
 +
 +  /**
 +   * @return the specific reason for this exception
 +   * 
 +   * @deprecated since 1.5.0; Use {@link #getSecurityErrorCode()} instead.
 +   */
 +  @Deprecated
 +  public org.apache.accumulo.core.security.thrift.SecurityErrorCode getErrorCode() {
 +    return org.apache.accumulo.core.security.thrift.SecurityErrorCode.valueOf(errorCode.name());
 +  }
 +
 +  @Override
 +  public String getMessage() {
 +    return "Error " + errorCode + " for user " + user + " - " + super.getMessage();
 +  }
 +}


Mime
View raw message