"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "linotpd/src/linotp/lib/policy/__init__.py" between
LinOTP-release-2.12.tar.gz and LinOTP-release-2.12.1.tar.gz

About: LinOTP is a flexible and versatile OTP-platform for strong user authentication (two-factor authentication with one time passwords).

__init__.py  (LinOTP-release-2.12):__init__.py  (LinOTP-release-2.12.1)
skipping to change at line 1729 skipping to change at line 1729
scope = enrollment, action = tokenissuer = <string> scope = enrollment, action = tokenissuer = <string>
The string can have the following variables: The string can have the following variables:
<u>: user <u>: user
<r>: realm <r>: realm
<s>: token serial <s>: token serial
This function is used to create 'otpauth' tokens This function is used to create 'otpauth' tokens
''' '''
tokenissuer = "LinOTP" tokenissuer = "LinOTP"
client = _get_client() client = _get_client()
action = "tokenissuer"
pol = has_client_policy(client, scope="enrollment", pol = has_client_policy(client, scope="enrollment", action=action,
realm=realm, user=user) realm=realm, user=user)
if len(pol) != 0: if len(pol) != 0:
string_issuer = getPolicyActionValue(pol, "tokenissuer", string_issuer = getPolicyActionValue(pol, action, is_string=True)
is_string=True)
if string_issuer: if string_issuer:
string_issuer = re.sub('<u>', user, string_issuer) string_issuer = re.sub('<u>', user, string_issuer)
string_issuer = re.sub('<r>', realm, string_issuer) string_issuer = re.sub('<r>', realm, string_issuer)
string_issuer = re.sub('<s>', serial, string_issuer) string_issuer = re.sub('<s>', serial, string_issuer)
tokenissuer = string_issuer tokenissuer = string_issuer
log.debug("[get_tokenissuer] providing tokenissuer = %r", tokenissuer) log.debug("[get_tokenissuer] providing tokenissuer = %r", tokenissuer)
return tokenissuer return tokenissuer
def get_tokenlabel(user="", realm="", serial=""): def get_tokenlabel(user="", realm="", serial=""):
skipping to change at line 1842 skipping to change at line 1842
return False return False
def get_autoassignment(user): def get_autoassignment(user):
''' '''
this function checks the policy scope=enrollment, action=autoassignment this function checks the policy scope=enrollment, action=autoassignment
This is a boolean policy. This is a boolean policy.
The function returns true, if autoassignment is defined. The function returns true, if autoassignment is defined.
''' '''
ret = False ret = False
client = _get_client() client = _get_client()
action = "autoassignment"
pol = has_client_policy(client, scope='enrollment', pol = has_client_policy(client, scope='enrollment', action=action,
realm=user.realm, user=user.login, userObj=user) realm=user.realm, user=user.login, userObj=user)
if len(pol) > 0: if len(pol) > 0:
val = getPolicyActionValue(pol, "autoassignment") val = getPolicyActionValue(pol, "autoassignment")
# with LinOTP 2.7 the autassign policy is treated as boolean # with LinOTP 2.7 the autassign policy is treated as boolean
if val is True: if val is True:
ret = True ret = True
# for backwar compatibility, we accept any values # for backwar compatibility, we accept any values
# other than -1, which indicates an error # other than -1, which indicates an error
elif val != -1: elif val != -1:
skipping to change at line 1867 skipping to change at line 1868
return ret return ret
def get_auto_enrollment(user): def get_auto_enrollment(user):
''' '''
this function checks the policy scope=enrollment, action=autoenrollment this function checks the policy scope=enrollment, action=autoenrollment
This policy policy returns the tokentyp: sms or email This policy policy returns the tokentyp: sms or email
The function returns true, if autoenrollment is defined. The function returns true, if autoenrollment is defined.
''' '''
ret = False ret = False
token_typ = '' token_typ = ''
action = "autoenrollment"
client = _get_client() client = _get_client()
pol = has_client_policy(client, scope='enrollment', pol = has_client_policy(client, scope='enrollment', action=action,
realm=user.realm, user=user.login, userObj=user) realm=user.realm, user=user.login, userObj=user)
if len(pol) > 0: if len(pol) > 0:
t_typ = getPolicyActionValue(pol, "autoenrollment", is_string=True) t_typ = getPolicyActionValue(pol, action, is_string=True)
log.debug("got the token type = %s", t_typ) log.debug("got the token type = %s", t_typ)
if type(t_typ) in [str, unicode] and t_typ.lower() in ['sms', 'email']: if type(t_typ) in [str, unicode] and t_typ.lower() in ['sms', 'email']:
ret = True ret = True
token_typ = t_typ.lower() token_typ = t_typ.lower()
return ret, token_typ return ret, token_typ
def autoassignment_forward(user): def autoassignment_forward(user):
 End of changes. 8 change blocks. 
6 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)