def do_login(sender, user, request, **kwargs):
 if (user and user.is_authenticated()):
  token = None
  try:
   Application = get_application_model()
   app = Application.objects.get(name='GeoServer')
   token = generate_token()
   AccessToken.objects.get_or_create(user=user, application=app, expires=(datetime.datetime.now() + datetime.timedelta(days=1)), token=token)
  except:
   u = uuid.uuid1()
   token = u.hex
  url = ('%s%s?access_token=%s' % (settings.OGC_SERVER['default']['PUBLIC_LOCATION'], 'ows?service=wms&version=1.3.0&request=GetCapabilities', token))
  cj = cookielib.CookieJar()
  opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
  jsessionid = None
  try:
   opener.open(url)
   for c in cj:
    if (c.name == 'JSESSIONID'):
     jsessionid = c.value
  except:
   u = uuid.uuid1()
   jsessionid = u.hex
  request.session['access_token'] = token
  request.session['JSESSIONID'] = jsessionid

def do_login ( sender , user , request , ** kwargs ) : if ( user and user . is_authenticated ( ) ) : token = None try : Application = get_application_model ( ) app = Application . objects . get ( name = 'GeoServer' ) token = generate_token ( ) AccessToken . objects . get_or_create ( user = user , application = app , expires = ( datetime . datetime . now ( ) + datetime . timedelta ( days = 1 ) ) , token = token ) except : u = uuid . uuid1 ( ) token = u . hex url = ( '%s%s?access_token=%s' % ( settings . OGC_SERVER [ 'default' ] [ 'PUBLIC_LOCATION' ] , 'ows?service=wms&version=1.3.0&request=GetCapabilities' , token ) ) cj = cookielib . CookieJar ( ) opener = urllib2 . build_opener ( urllib2 . HTTPCookieProcessor ( cj ) ) jsessionid = None try : opener . open ( url ) for c in cj : if ( c . name == 'JSESSIONID' ) : jsessionid = c . value except : u = uuid . uuid1 ( ) jsessionid = u . hex request . session [ 'access_token' ] = token request . session [ 'JSESSIONID' ] = jsessionid
take action on user login .