Index: src/webapp/apigility-testing/db-config-setup.sql
===================================================================
--- src/webapp/apigility-testing/db-config-setup.sql	(revision 74c3571b330568daeee1f4562299f3daae280ddf)
+++ src/webapp/apigility-testing/db-config-setup.sql	(revision 74c3571b330568daeee1f4562299f3daae280ddf)
@@ -0,0 +1,35 @@
+INSERT INTO oauth_users (
+    username,
+    password,
+    first_name,
+    last_name)
+VALUES (
+    "testuser",
+    "test",
+    "Test",
+    "User"
+);
+
+INSERT INTO oauth_clients (
+    client_id,
+    client_secret,
+    redirect_uri,
+    user_id)
+VALUES (
+    "testclient",
+    "$2y$14$f3qml4G2hG6sxM26VMq.geDYbsS089IBtVJ7DlD05BoViS9PFykE2",
+    "/oauth/receivecode",
+    "testuser"
+);
+
+INSERT INTO waters (
+	label,
+	osm_id,
+	osm_type,
+	osm_class)
+VALUES (
+	"Forggensee",
+	897899,
+	"R",
+	'natural'
+);
Index: src/webapp/apigility-testing/db-setup.sql
===================================================================
--- src/webapp/apigility-testing/db-setup.sql	(revision 74c3571b330568daeee1f4562299f3daae280ddf)
+++ src/webapp/apigility-testing/db-setup.sql	(revision 74c3571b330568daeee1f4562299f3daae280ddf)
@@ -0,0 +1,92 @@
+/*
+	SQL structere for oauth
+*/
+CREATE TABLE IF NOT EXISTS oauth_users (
+    username VARCHAR(255) NOT NULL,
+    password VARCHAR(2000),
+    first_name VARCHAR(255),
+    last_name VARCHAR(255),
+    CONSTRAINT username_pk PRIMARY KEY (username)
+);
+CREATE TABLE IF NOT EXISTS oauth_clients (
+    client_id VARCHAR(80) NOT NULL,
+    client_secret VARCHAR(80) NOT NULL,
+    redirect_uri VARCHAR(2000) NOT NULL,
+    grant_types VARCHAR(80),
+    scope VARCHAR(2000),
+    user_id VARCHAR(255),
+    CONSTRAINT clients_client_id_pk PRIMARY KEY (client_id),
+    FOREIGN KEY (user_id) REFERENCES oauth_users(username)
+);
+CREATE TABLE IF NOT EXISTS oauth_access_tokens (
+    access_token VARCHAR(40) NOT NULL,
+    client_id VARCHAR(80) NOT NULL,
+    user_id VARCHAR(255),
+    expires TIMESTAMP NOT NULL,
+    scope VARCHAR(2000),
+    CONSTRAINT access_token_pk PRIMARY KEY (access_token),
+    FOREIGN KEY (client_id) REFERENCES oauth_clients(client_id),
+    FOREIGN KEY (user_id) REFERENCES oauth_users(username)
+);
+CREATE TABLE IF NOT EXISTS oauth_authorization_codes (
+    authorization_code VARCHAR(40) NOT NULL,
+    client_id VARCHAR(80) NOT NULL,
+    user_id VARCHAR(255),
+    redirect_uri VARCHAR(2000),
+    expires TIMESTAMP NOT NULL,
+    scope VARCHAR(2000),
+    id_token VARCHAR(2000),
+    CONSTRAINT auth_code_pk PRIMARY KEY (authorization_code),
+    FOREIGN KEY (client_id) REFERENCES oauth_clients(client_id),
+    FOREIGN KEY (user_id) REFERENCES oauth_users(username)
+);
+CREATE TABLE IF NOT EXISTS oauth_refresh_tokens (
+    refresh_token VARCHAR(40) NOT NULL,
+    client_id VARCHAR(80) NOT NULL,
+    user_id VARCHAR(255),
+    expires TIMESTAMP NOT NULL,
+    scope VARCHAR(2000),
+    CONSTRAINT refresh_token_pk PRIMARY KEY (refresh_token),
+    FOREIGN KEY (client_id) REFERENCES oauth_clients(client_id),
+    FOREIGN KEY (user_id) REFERENCES oauth_users(username)
+);
+CREATE TABLE IF NOT EXISTS oauth_scopes (
+    type VARCHAR(255) NOT NULL DEFAULT "supported",
+    scope VARCHAR(2000),
+    client_id VARCHAR (80),
+    is_default SMALLINT DEFAULT NULL,
+    FOREIGN KEY (client_id) REFERENCES oauth_clients(client_id)
+);
+CREATE TABLE IF NOT EXISTS oauth_jwt (
+    client_id VARCHAR(80) NOT NULL,
+    subject VARCHAR(80),
+    public_key VARCHAR(2000),
+    CONSTRAINT jwt_client_id_pk PRIMARY KEY (client_id),
+    FOREIGN KEY (client_id) REFERENCES oauth_clients(client_id)
+);
+
+/*
+	SQL Structure for GnuBoat
+*/
+CREATE TABLE IF NOT EXISTS waters (
+	water_id BIGINT NOT NULL AUTO_INCREMENT,
+	label VARCHAR(500) NOT NULL,
+	osm_id BIGINT,
+	osm_type VARCHAR(255),
+	osm_class VARCHAR(255),
+	PRIMARY KEY(water_id)
+);
+
+CREATE TABLE IF NOT EXISTS gauges (
+	gauge_id BIGINT NOT NULL AUTO_INCREMENT,
+	label VARCHAR(500) NOT NULL,
+	manager VARCHAR(255) NOT NULL,
+	location POINT,
+	water_id BIGINT NOT NULL,
+	comment VARCHAR(2000),
+	osm_type VARCHAR(255),
+	osm_id BIGINT,
+	PRIMARY KEY(gauge_id),
+	FOREIGN KEY (manager) REFERENCES oauth_users(username),
+	FOREIGN KEY (water_id) REFERENCES waters(water_id)
+);
Index: src/webapp/apigility-testing/test-authorization
===================================================================
--- src/webapp/apigility-testing/test-authorization	(revision 74c3571b330568daeee1f4562299f3daae280ddf)
+++ src/webapp/apigility-testing/test-authorization	(revision 74c3571b330568daeee1f4562299f3daae280ddf)
@@ -0,0 +1,41 @@
+#!/usr/bin/python
+"""
+    Copyright (C) 2019 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+"""
+
+import requests
+import json
+
+server='http://localhost:8080'
+client_id = 'testclient'
+client_secret = 'testpass'
+
+r = requests.post("{}/oauth".format(server), auth=('testclient', 'testpass'), data={'grant_type': 'client_credentials'})
+print(r.status_code, r.reason)
+response = r.json()
+print("Recieved access token {} of type {}".format(response['access_token'], response['token_type']))
+
+header_auth = {'Authorization': '{} {}'.format(response['token_type'], response['access_token'])}
+r = requests.post("{}/oauth/resource".format(server), headers=header_auth)
+print(r.status_code, r.reason)
+print(r.json())
+
+headers = header_auth
+headers['Accept'] = 'application/json'
+headers['Content-Type'] = 'application/json'
+r = requests.post("{}/waters".format(server), headers=headers, data=json.dumps({'label': 'Forggensee'}))
+print(r.status_code, r.reason)
+print(r.json())
