<s> import logging <EOL> import time <EOL> from django . conf import settings <EOL> from django . contrib import auth <EOL> from django import http as django_http <EOL> from django import shortcuts <EOL> from django . views . decorators . cache import never_cache <EOL> from django . views . decorators . csrf import csrf_exempt <EOL> from django . views . decorators . csrf import csrf_protect <EOL> from django . views . decorators . debug import sensitive_post_parameters <EOL> from openstack_auth import user as auth_user <EOL> LOG = logging . getLogger ( __name__ ) <EOL> @ sensitive_post_parameters ( ) <EOL> @ csrf_exempt <EOL> @ never_cache <EOL> def kerberos_login ( request ) : <EOL> """<STR_LIT>""" <EOL> user = auth . authenticate ( request = request ) <EOL> if user and user . is_authenticated ( ) : <EOL> auth . login ( request , user ) <EOL> res = shortcuts . redirect ( settings . LOGIN_REDIRECT_URL ) <EOL> auth_user . set_session_from_user ( request , user ) <EOL> request . session [ '<STR_LIT>' ] = int ( time . time ( ) ) <EOL> else : <EOL> res = django_http . HttpResponse ( '<STR_LIT>' , status = <NUM_LIT> ) <EOL> return res </s>
