Package org.apache.cassandra.thrift

Examples of org.apache.cassandra.thrift.AuthorizationException


            // structure:
            // given keyspace X, users A B and C can be authorized like this (separate their names with spaces):
            // X = A B C
           
            // note we keep the message here and for other authorization problems exactly the same to prevent attackers from guessing what keyspaces are valid
            if (null == props.getProperty(keyspace)) throw new AuthorizationException(authorizationErrorMessage(keyspace, username));
            for (String allow : props.getProperty(keyspace).split(","))
            {
                if (allow.equals(username)) authorized = true;
            }
        }
        catch (FileNotFoundException e)
        {
            throw new RuntimeException("Authorization table file given by property " + ACCESS_FILENAME_PROPERTY + " could not be found: " + e.getMessage());
        }
        catch (IOException e)
        {
            throw new RuntimeException("Authorization table file given by property " + ACCESS_FILENAME_PROPERTY + " could not be opened: " + e.getMessage());
        }
        catch (Exception e)
        {
            throw new RuntimeException("Unexpected authorization problem", e);
        }

        if (!authorized) throw new AuthorizationException(authorizationErrorMessage(keyspace, username));
    }
View Full Code Here


            // structure:
            // given keyspace X, users A B and C can be authorized like this (separate their names with spaces):
            // X = A B C
           
            // note we keep the message here and for other authorization problems exactly the same to prevent attackers from guessing what keyspaces are valid
            if (null == props.getProperty(keyspace)) throw new AuthorizationException(authorizationErrorMessage(keyspace, username));
            for (String allow : props.getProperty(keyspace).split(","))
            {
                if (allow.equals(username)) authorized = true;
            }
        }
        catch (FileNotFoundException e)
        {
            throw new RuntimeException("Authorization table file given by property " + ACCESS_FILENAME_PROPERTY + " could not be found: " + e.getMessage());
        }
        catch (IOException e)
        {
            throw new RuntimeException("Authorization table file given by property " + ACCESS_FILENAME_PROPERTY + " could not be opened: " + e.getMessage());
        }
        catch (Exception e)
        {
            throw new RuntimeException("Unexpected authorization problem", e);
        }

        if (!authorized) throw new AuthorizationException(authorizationErrorMessage(keyspace, username));
    }
View Full Code Here

            // structure:
            // given keyspace X, users A B and C can be authorized like this (separate their names with spaces):
            // X = A B C
           
            // note we keep the message here and for other authorization problems exactly the same to prevent attackers from guessing what keyspaces are valid
            if (null == props.getProperty(keyspace)) throw new AuthorizationException(authorizationErrorMessage(keyspace, username));
            for (String allow : props.getProperty(keyspace).split(","))
            {
                if (allow.equals(username)) authorized = true;
            }
        }
        catch (FileNotFoundException e)
        {
            throw new RuntimeException("Authorization table file given by property " + ACCESS_FILENAME_PROPERTY + " could not be found: " + e.getMessage());
        }
        catch (IOException e)
        {
            throw new RuntimeException("Authorization table file given by property " + ACCESS_FILENAME_PROPERTY + " could not be opened: " + e.getMessage());
        }
        catch (Exception e)
        {
            throw new RuntimeException("Unexpected authorization problem", e);
        }

        if (!authorized) throw new AuthorizationException(authorizationErrorMessage(keyspace, username));
    }
View Full Code Here

            // structure:
            // given keyspace X, users A B and C can be authorized like this (separate their names with spaces):
            // X = A B C
           
            // note we keep the message here and for other authorization problems exactly the same to prevent attackers from guessing what keyspaces are valid
            if (null == props.getProperty(keyspace)) throw new AuthorizationException(authorizationErrorMessage(keyspace, username));
            for (String allow : props.getProperty(keyspace).split(","))
            {
                if (allow.equals(username)) authorized = true;
            }
        }
        catch (FileNotFoundException e)
        {
            throw new RuntimeException("Authorization table file given by property " + AUTHORIZATION_FILENAME_PROPERTY + " could not be found: " + e.getMessage());
        }
        catch (IOException e)
        {
            throw new RuntimeException("Authorization table file given by property " + AUTHORIZATION_FILENAME_PROPERTY + " could not be opened: " + e.getMessage());
        }
        catch (Exception e)
        {
            throw new RuntimeException("Unexpected authorization problem", e);
        }

        if (!authorized) throw new AuthorizationException(authorizationErrorMessage(keyspace, username));
    }
View Full Code Here

            // X = A B C
           
            // note we keep the message here and for other authorization problems exactly the same to prevent attackers
            // from guessing what keyspaces are valid
            if (null == props.getProperty(keyspace))
                throw new AuthorizationException(authorizationErrorMessage(keyspace, username));

            for (String allow : props.getProperty(keyspace).split(","))
            {
                if (allow.equals(username)) authorized = AccessLevel.FULL;
            }
        }
        catch (FileNotFoundException e)
        {
            throw new RuntimeException("Authorization table file given by property " + ACCESS_FILENAME_PROPERTY + " could not be found: " + e.getMessage());
        }
        catch (IOException e)
        {
            throw new RuntimeException("Authorization table file given by property " + ACCESS_FILENAME_PROPERTY + " could not be opened: " + e.getMessage());
        }

        if (authorized == AccessLevel.NONE) throw new AuthorizationException(authorizationErrorMessage(keyspace, username));
       
        return authorized;
    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.thrift.AuthorizationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.