hswaw/lib: add flask_spaceauth

Change-Id: I3bb47bb65e739eaf27f54c07f03df18e79b398e0
diff --git a/hswaw/lib/flask_spaceauth/example.py b/hswaw/lib/flask_spaceauth/example.py
new file mode 100644
index 0000000..b3d9050
--- /dev/null
+++ b/hswaw/lib/flask_spaceauth/example.py
@@ -0,0 +1,29 @@
+from flask import Flask, request, url_for, Markup
+
+from hswaw.lib.flask_spaceauth.spaceauth import SpaceAuth, login_required, \
+    cap_required, current_user
+
+app = Flask('spaceauth-example')
+app.config['SECRET_KEY'] = 'testing'
+app.config['SPACEAUTH_CONSUMER_KEY'] = 'testing'
+app.config['SPACEAUTH_CONSUMER_SECRET'] = 'asdTasdfhwqweryrewegfdsfJIxkGc'
+auth = SpaceAuth(app)
+
+@app.route('/')
+def index():
+    return Markup('Hey! <a href="%s">Login with spaceauth</a> / %r') % (
+            url_for('spaceauth.login'), current_user)
+
+@app.route('/profile')
+@login_required
+def profile():
+    return Markup('Hey {}!').format(spaceauth.current_user)
+
+@app.route('/staff')
+@cap_required('staff')
+def staff_only():
+    return 'This is staff-only zone!'
+
+
+if __name__ == "__main__":
+    app.run()