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 Helper method, so we can get the auth call back url for an authenticator
''' '''
from django.core.urlresolvers import reverse 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): def authInfoUrl(authenticator):
''' '''

View File

@ -57,7 +57,7 @@ urlpatterns = patterns('uds',
(r'^xmlrpc$', 'xmlrpc.views.xmlrpc'), (r'^xmlrpc$', 'xmlrpc.views.xmlrpc'),
# Custom authentication callback # Custom authentication callback
(r'^auth/(?P<idAuth>.+)', 'web.views.authCallback'), (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'), (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)) 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 This url is provided so external SSO authenticators can get an url for
redirecting back the users. redirecting back the users.
@ -271,7 +271,7 @@ def authCallback(request, idAuth):
''' '''
from uds.core.auths.Exceptions import InvalidUserException from uds.core.auths.Exceptions import InvalidUserException
try: try:
authenticator = Authenticator.objects.get(pk=idAuth) authenticator = Authenticator.objects.get(name=authName)
params = request.GET.copy() params = request.GET.copy()
params.update(request.POST) params.update(request.POST)
@ -285,10 +285,11 @@ def authCallback(request, idAuth):
__authLog(request, authenticator, '{0}'.format(params), False, os, 'Invalid at auth callback') __authLog(request, authenticator, '{0}'.format(params), False, os, 'Invalid at auth callback')
raise InvalidUserException() 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)}, response = render_to_response('uds/detectJava.html', { 'idAuth' : scrambleId(request, authenticator.id)},
context_instance=RequestContext(request)) context_instance=RequestContext(request))
webLogin(request, response, user, '') # Password webLogin(request, response, user, '') # Password is unavailable in this case
request.session['OS'] = os request.session['OS'] = os
# Now we render an intermediate page, so we get Java support from user # Now we render an intermediate page, so we get Java support from user
# It will only detect java, and them redirect to Java # It will only detect java, and them redirect to Java