aboutsummaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorJustin J. Novack <jnovack@gmail.com>2012-09-16 01:17:46 -0400
committerJustin J. Novack <jnovack@gmail.com>2012-09-16 01:17:46 -0400
commita73791f16d10ea0e2c477f29d9049d75516aa774 (patch)
treec5cc7406b5710804600477a45d20fa21815c67a3 /data
parentb0687c328fcaa4d891b31c2146694654cd4707c9 (diff)
downloadphorkie-a73791f16d10ea0e2c477f29d9049d75516aa774.tar.gz
phorkie-a73791f16d10ea0e2c477f29d9049d75516aa774.zip
Added OpenID Authentication
Diffstat (limited to 'data')
-rw-r--r--data/config.default.php5
-rw-r--r--data/config.php.dist4
-rw-r--r--data/templates/base.htm8
-rw-r--r--data/templates/forbidden.htm21
-rw-r--r--data/templates/login.htm44
5 files changed, 82 insertions, 0 deletions
diff --git a/data/config.default.php b/data/config.default.php
index 88c9ae5..7ecbda3 100644
--- a/data/config.default.php
+++ b/data/config.default.php
@@ -12,6 +12,11 @@ $GLOBALS['phorkie']['cfg'] = array(
'geshi' => 'MediaWiki/geshi/geshi/geshi.php',
'index' => 'new'//"new" or "list"
);
+$GLOBALS['phorkie']['auth'] = array(
+ 'secure' => 0, // 0 = public, no authentication, 1 = protect adds/edits/deletes, 2 = use authentication
+ 'userlist' => false, // true = user must be explicitly defined, false = anyone allowed, but they must authenticate
+ 'anonymousEmail' => 'anonymous@phorkie' // Email for non-authenticated commits
+);
$GLOBALS['phorkie']['tools'] = array(
'\\phorkie\\Tool_Xmllint' => true,
'\\phorkie\\Tool_PHPlint' => true,
diff --git a/data/config.php.dist b/data/config.php.dist
index 1e814bd..e90f704 100644
--- a/data/config.php.dist
+++ b/data/config.php.dist
@@ -5,4 +5,8 @@
//$GLOBALS['phorkie']['cfg']['git']['private'] = 'ssh://git@bogo:paste/';
//$GLOBALS['phorkie']['cfg']['elasticsearch'] = 'http://localhost:9200/phorkie/';
//$GLOBALS['phorkie']['cfg']['setupcheck'] = false;
+//$GLOBALS['phorkie']['users'] = array(
+// 'https://www.google.com/accounts/o8/id?id=ABCDEFGHIJKLMNOPQRSTUVWXYZ',
+// 'http://anonymous.phorkie.openid'
+//);
?>
diff --git a/data/templates/base.htm b/data/templates/base.htm
index 2b8544b..8192b6b 100644
--- a/data/templates/base.htm
+++ b/data/templates/base.htm
@@ -25,6 +25,14 @@
<li>
<a href="/list">List all</a>
</li>
+ {% if identity %}
+ <li>
+ <a href="#">{{name}} ({{email}})</a>
+ </li>
+ <li>
+ <a href="/auth?logout">Logout</a>
+ </li>
+ {% endif %}
{% if db.adapter %}
<li>
<form class="navbar-search pull-left" action="/search" method="get">
diff --git a/data/templates/forbidden.htm b/data/templates/forbidden.htm
new file mode 100644
index 0000000..ad40a9f
--- /dev/null
+++ b/data/templates/forbidden.htm
@@ -0,0 +1,21 @@
+{% extends "base.htm" %}
+{% block title %}Access Denied{% endblock %}
+
+{% block content %}
+
+<fieldset>
+ <legend>Access Denied</legend>
+ <img src="images/access_denied.png">
+</fieldset>
+{% endblock %}
+
+{% block sidebar %}
+ {% if recents.results %}
+ <h3>Recently created</h3>
+ <ul>
+ {% for repo in recents.repos %}
+ {% include 'repo-sidebar-list.htm' %}
+ {% endfor %}
+ </ul>
+ {% endif %}
+{% endblock %}
diff --git a/data/templates/login.htm b/data/templates/login.htm
new file mode 100644
index 0000000..13d86be
--- /dev/null
+++ b/data/templates/login.htm
@@ -0,0 +1,44 @@
+{% extends "base.htm" %}
+{% block title %}Login{% endblock %}
+
+{% block content %}
+
+<!-- Simple OpenID Selector -->
+<link rel="stylesheet" href="css/openid.css" />
+
+<style type="text/css">
+/* Basic page formatting. */
+</style>
+
+<form method="post" action="/auth" id="openid_form">
+ <input id="start" name="start" type="hidden" value="submit" />
+ <input id="sreg" name="sreg" type="hidden" value="on" />
+ <input id="ax" name="ax" type="hidden" value="on" />
+
+<fieldset>
+ <legend>Sign-in</legend>
+ <div id="openid_choice" style="display: block; ">
+ <p>Please choose your account provider</p>
+ <div id="openid_btns">
+ <a title="Google" href="/auth?identifier=https://www.google.com/accounts/o8/id&ax=on&sreg=on&start=submit" class="google openid_large_btn"></a>
+ <a title="Yahoo" href="/auth?identifier=http://yahoo.com&ax=on&sreg=on&start=submit" class="yahoo openid_large_btn"></a>
+ </div>
+ <div id="openid_input_area">
+ <p>or enter your OpenID URL.</p>
+ <input class="" id="identifier" type="text" name="identifier" value="http://">
+ <input class="btn" id="openid_submit" type="submit" value="Sign-In">
+ </div>
+ </div>
+</fieldset>
+{% endblock %}
+
+{% block sidebar %}
+ {% if recents.results %}
+ <h3>Recently created</h3>
+ <ul>
+ {% for repo in recents.repos %}
+ {% include 'repo-sidebar-list.htm' %}
+ {% endfor %}
+ </ul>
+ {% endif %}
+{% endblock %}