Package com.foundationdb.server.error

Examples of com.foundationdb.server.error.SecurityException


            conn = openConnection();
            stmt = conn.prepareStatement(ADD_ROLE_SQL);
            stmt.setString(1, name);
            int nrows = stmt.executeUpdate();
            if (nrows != 1) {
                throw new SecurityException("Failed to add role " + name);
            }
            conn.commit();
        }
        catch (SQLException ex) {
            throw new SecurityException("Error adding role", ex);
        }
        finally {
            cleanup(conn, stmt);

        }
View Full Code Here


            conn = openConnection();
            stmt = conn.prepareStatement(DELETE_ROLE_SQL);
            stmt.setString(1, name);
            int nrows = stmt.executeUpdate();
            if (nrows != 1) {
                throw new SecurityException("Failed to delete role");
            }
            conn.commit();
        }
        catch (SQLException ex) {
            throw new SecurityException("Error deleting role", ex);
        }
        finally {
            cleanup(conn, stmt);
        }
    }
View Full Code Here

            }
            rs.close();
            conn.commit();
        }
        catch (SQLException ex) {
            throw new SecurityException("Error adding role", ex);
        }
        finally {
            cleanup(conn, stmt);
        }
        return user;
View Full Code Here

            stmt.setString(2, basicPassword);
            stmt.setString(3, digestPassword);
            stmt.setString(4, md5Password(name, password));
            int nrows = stmt.executeUpdate();
            if (nrows != 1) {
                throw new SecurityException("Failed to add user " + name);
            }
            ResultSet rs = stmt.getGeneratedKeys();
            if (rs.next()) {
                id = rs.getInt(1);
            }
            else {
                throw new SecurityException("Failed to get user id for " + name);
            }
            rs.close();
            stmt.close();
            stmt = null;
            stmt = conn.prepareStatement(ADD_USER_ROLE_SQL);
            stmt.setInt(1, id);
            for (String role : roles) {
                stmt.setString(2, role);
                nrows = stmt.executeUpdate();
                if (nrows != 1) {
                    throw new SecurityException("Failed to add role " + role);
                }
            }
            conn.commit();
        }
        catch (SQLException ex) {
            throw new SecurityException("Error adding user", ex);
        }
        finally {
            cleanup(conn, stmt);
        }
        return new User(id, name, basicPassword, digestPassword, new ArrayList<>(roles));
View Full Code Here

            stmt = null;
            stmt = conn.prepareStatement(DELETE_USER_SQL);
            stmt.setString(1, name);
            int nrows = stmt.executeUpdate();
            if (nrows != 1) {
                throw new SecurityException("Failed to delete user");
            }
            conn.commit();
            monitor.deregisterUserMonitor(name);
        }
        catch (SQLException ex) {
            throw new SecurityException("Error deleting user", ex);
        }
        finally {
            cleanup(conn, stmt);
        }
    }
View Full Code Here

            stmt.setString(2, digestPassword(name, password));
            stmt.setString(3, md5Password(name, password));
            stmt.setString(4, name);
            int nrows = stmt.executeUpdate();
            if (nrows != 1) {
                throw new SecurityException("Failed to change user");
            }
            conn.commit();
        }
        catch (SQLException ex) {
            throw new SecurityException("Error changing user", ex);
        }
        finally {
            cleanup(conn, stmt);
        }
    }
View Full Code Here

            }
            rs.close();
            conn.commit();
        }
        catch (SQLException ex) {
            throw new SecurityException("Error adding role", ex);
        }
        finally {
            cleanup(conn, stmt);
        }
        if (user == null) {
View Full Code Here

            }
            rs.close();
            conn.commit();
        }
        catch (SQLException ex) {
            throw new SecurityException("Error adding role", ex);
        }
        finally {
            cleanup(conn, stmt);
        }
        if (user == null) {
View Full Code Here

            stmt.execute("DELETE FROM users");
            stmt.execute("DELETE FROM roles");
            conn.commit();
        }
        catch (SQLException ex) {
            throw new SecurityException("Error adding role", ex);
        }
        finally {
            cleanup(conn, stmt);
        }
        session.remove(SESSION_KEY);
View Full Code Here

        return null;
    }

    protected void doOperation (PostgresServerSession session) throws Exception {
        if (!session.getSecurityService().hasRestrictedAccess(session.getSession()))
            throw new SecurityException("Operation not allowed");
        PostgresServerConnection current = (PostgresServerConnection)session;
        PostgresServer server = current.getServer();
        Integer sessionId = statement.getSessionID();
        String byUser = session.getProperty("user");
        String completeCurrent = null;
View Full Code Here

TOP

Related Classes of com.foundationdb.server.error.SecurityException

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.