+++ /dev/null
-# import the User object
-from django.contrib.auth.models import User
-
-import time
-
-# Name my backend 'MyCustomBackend'
-class MyCustomBackend:
-
- hard_wired_users = { 'jean': '1234',
- 'root': '2345',
- 'jacques': '3456',
- }
-
-
- # Create an authentication method
- # This is called by the standard Django login procedure
- def authenticate(self, token=None):
- username=token['username']
- password=token['password']
- users=MyCustomBackend.hard_wired_users
- if username not in users: return None
- if password != users[username]: return None
- try:
- # Check if the user exists in Django's local database
- user = User.objects.get(email=username)
- except User.DoesNotExist:
- print 'creating django user',username
- # Create a user in Django's local database
- # warning: the trick here is pass current time as an id, and name as email
- # create_user(username, email=None, password=None)
- user = User.objects.create_user(time.time(), username, 'password-doesnt-matter')
-
- return user
-
- # Required for your backend to work properly - unchanged in most scenarios
- def get_user(self, user_id):
- try:
- return User.objects.get(pk=user_id)
- except User.DoesNotExist:
- return None
from django.contrib.auth import authenticate, login, logout
from django.http import HttpResponseRedirect
-from auth.backend import MyCustomBackend
-
from myslice.viewutils import topmenu_items, the_user
from myslice.config import Config
def login_user(request):
state = "Please log in below..."
username = password = ''
- env={'hard_wired_users':MyCustomBackend.hard_wired_users,
- 'manifold_url':Config.manifold_url,
- }
+ env={
+ 'manifold_url':Config.manifold_url,
+ }
if request.POST:
username = request.POST.get('username')
}
}
-AUTHENTICATION_BACKENDS = ( 'auth.backend.MyCustomBackend', 'auth.manifoldbackend.ManifoldBackend', )
+AUTHENTICATION_BACKENDS = ( 'auth.manifoldbackend.ManifoldBackend', )
### the view to redirect malformed (i.e. with a wrong CSRF) incoming requests
# without this setting django will return a 403 forbidden error, which is fine
{% block unfold2_main %}
<!--
-<code> This page is currently connected to two authentication systems:</code>
+<code> This page is currently connected to one authentication system:</code>
<ul>
<li> A manifold server, located at <code>{{ manifold_url }}</code>, (configured in <code>myslice/config.py</code>), and</li>
-<li>
-as a proof of concept, a set of hardwired user accounts, see <code>auth/backend.py</code> for more details. However these won't of course have the ability to run real queries at the backend so it's more for testing login and all this.
-Currently hard wired users are:
-<ul>
- {% for k,v in hard_wired_users.iteritems %}
- <li class='well'> Name= <code>{{ k }}</code>, Password= <code>{{ v }}</code> </li>
- {% endfor %}
</ul>
-</li></ul>
+<p>
+as a proof of concept, a set of hardwired user accounts used to be available but as these would not let you do anything valuable with the backend it is now turned off.
+</p>
-->
<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}/css/register.css" />
<div style='padding: 20px;'>
federated testbeds.
</p>
<div class="item-separator"></div>
+<p>This UI server is connected to the manifold backend running at <code>{{ manifold_url }}</code>.</p>
</div>
{% endblock unfold2_main %}