class AuthScopeRdbmsDao extends AuthScopeDao {

    @Override
    public List<AuthScope> readAll() throws AuthServerException {
        Map<String, AuthScope> authScopes = new HashMap<>();
        Connection connection = null;
        PreparedStatement statement = null;
        ResultSet resultSet = null;
        try {
            connection = getConnection();
            statement = connection.prepareStatement(RdbmsConstants.PS_SELECT_ALL_AUTH_SCOPES);
            resultSet = statement.executeQuery();
            while (resultSet.next()) {
                String scopeName = resultSet.getString(1);
                AuthScope authScope = authScopes.get(scopeName);
                if (Objects.isNull(authScope)) {
                    authScope = new AuthScope(scopeName, new HashSet<>());
                    authScopes.put(scopeName, authScope);
                }
                if (Objects.nonNull(resultSet.getString(2))) {
                    authScope.addUserGroup(resultSet.getString(2));
                }
            }
        } catch (SQLException e) {
            throw new AuthServerException("Error occurred while retrieving scopes", e);
        } finally {
            close(connection, statement, resultSet);
        }

        return new ArrayList<>(authScopes.values());

    }

    public  AuthScopeRdbmsDao(DataSource dataSource);

}