Changed authentication callback url generation, so it uses name instead of database id.

This commit is contained in:
Adolfo Gómez 2012-07-25 12:36:03 +00:00
parent 8367707a7b
commit f182647d81
3 changed files with 6 additions and 5 deletions

View File

@ -167,7 +167,7 @@ def authCallbackUrl(authenticator):
Helper method, so we can get the auth call back url for an authenticator
'''
from django.core.urlresolvers import reverse
return reverse('uds.web.views.authCallback', kwargs={'idAuth': authenticator.id})
return reverse('uds.web.views.authCallback', kwargs={'authName': authenticator.name})
def authInfoUrl(authenticator):
'''

View File

@ -57,7 +57,7 @@ urlpatterns = patterns('uds',
(r'^xmlrpc$', 'xmlrpc.views.xmlrpc'),
# Custom authentication callback
(r'^auth/(?P<idAuth>.+)', 'web.views.authCallback'),
(r'^authJava/(?P<idAuth>.+)/(?P<hasJava>.*)$', 'web.views.authJava'),
(r'^authJava/(?P<authName>.+)/(?P<hasJava>.*)$', 'web.views.authJava'),
(r'^authinfo/(?P<authName>.+)', 'web.views.authInfo'),
)

View File

@ -261,7 +261,7 @@ def error(request, idError):
return render_to_response('uds/error.html', {'errorString' : errors.errorString(idError) }, context_instance=RequestContext(request))
def authCallback(request, idAuth):
def authCallback(request, authName):
'''
This url is provided so external SSO authenticators can get an url for
redirecting back the users.
@ -271,7 +271,7 @@ def authCallback(request, idAuth):
'''
from uds.core.auths.Exceptions import InvalidUserException
try:
authenticator = Authenticator.objects.get(pk=idAuth)
authenticator = Authenticator.objects.get(name=authName)
params = request.GET.copy()
params.update(request.POST)
@ -285,10 +285,11 @@ def authCallback(request, idAuth):
__authLog(request, authenticator, '{0}'.format(params), False, os, 'Invalid at auth callback')
raise InvalidUserException()
# Redirect to main page through java detection process, so UDS know the availability of java
response = render_to_response('uds/detectJava.html', { 'idAuth' : scrambleId(request, authenticator.id)},
context_instance=RequestContext(request))
webLogin(request, response, user, '') # Password
webLogin(request, response, user, '') # Password is unavailable in this case
request.session['OS'] = os
# Now we render an intermediate page, so we get Java support from user
# It will only detect java, and them redirect to Java