roadrecon 1.5.0__py3-none-any.whl → 1.6.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,6 +25,7 @@ from roadtools.roadlib.metadef.database import (
25
25
  from sqlalchemy import bindparam, func, text
26
26
  from sqlalchemy.dialects.postgresql import insert as pginsert
27
27
  from sqlalchemy.orm import sessionmaker
28
+ from datetime import datetime
28
29
 
29
30
  warnings.simplefilter('ignore')
30
31
  token = None
@@ -124,11 +125,14 @@ def checktoken():
124
125
  auth.tokendata = token
125
126
  if 'useragent' in token:
126
127
  auth.set_user_agent(token['useragent'])
128
+ if 'originheader' in token:
129
+ auth.set_origin_value(token['originheader'])
127
130
  if 'refreshToken' in token:
131
+ print("- Attempting token refresh -")
128
132
  token = auth.authenticate_with_refresh(token)
129
133
  headers['Authorization'] = '%s %s' % (token['tokenType'], token['accessToken'])
130
134
  expiretime = time.time() + token['expiresIn']
131
- print('Refreshed token')
135
+ print('+ Refreshed token +')
132
136
  return True
133
137
  elif time.time() > expiretime:
134
138
  print('Access token is expired, but no access to refresh token! Dumping will fail')
@@ -129,6 +129,11 @@ class AccessPoliciesPlugin():
129
129
  return self.session.query(ServicePrincipal).filter(ServicePrincipal.objectId.in_(uid)).all()
130
130
  return self.session.query(ServicePrincipal).filter(ServicePrincipal.objectId == uid).first()
131
131
 
132
+ def _get_serviceprincipalrule(self, rule):
133
+ if isinstance(rule, list):
134
+ return [', '.join(rule)]
135
+ return [rule]
136
+
132
137
  def _get_role(self, rid):
133
138
  if isinstance(rid, list):
134
139
  return self.session.query(DirectoryRole).filter(DirectoryRole.roleTemplateId.in_(rid)).all()
@@ -174,6 +179,7 @@ class AccessPoliciesPlugin():
174
179
  'Groups' : self._get_group,
175
180
  'Roles': self._get_role,
176
181
  'ServicePrincipals': self._get_serviceprincipal,
182
+ 'ServicePrincipalFilterRule': self._get_serviceprincipalrule,
177
183
  'GuestsOrExternalUsers': self._translate_guestsexternal
178
184
  }
179
185
  ot = ''
@@ -206,6 +212,9 @@ class AccessPoliciesPlugin():
206
212
  elif ctype == 'GuestsOrExternalUsers':
207
213
  ot += 'Guests or external user types: '
208
214
  ot += ', '.join([escape(uobj) for uobj in objects])
215
+ elif ctype == 'ServicePrincipalFilterRule':
216
+ ot += 'Service Principals matching the following filter: '
217
+ ot += ', '.join([escape(sprule) for sprule in objects])
209
218
  else:
210
219
  raise Exception('Unsupported criterium type: {0}'.format(ctype))
211
220
  else:
@@ -229,6 +238,8 @@ class AccessPoliciesPlugin():
229
238
  break
230
239
  if 'Office365' in clist:
231
240
  ot += 'All Office 365 applications'
241
+ if 'MicrosoftAdminPortals' in clist:
242
+ ot += 'All Microsoft Admin Portals'
232
243
  objects = self._get_application(clist)
233
244
  if objects is not None:
234
245
  if len(objects) > 0:
@@ -41,7 +41,7 @@ class RTModelSchema(ma.SQLAlchemyAutoSchema):
41
41
  class UsersSchema(ma.Schema):
42
42
  class Meta:
43
43
  model = User
44
- fields = ('objectId', 'objectType', 'userPrincipalName', 'displayName', 'mail', 'lastDirSyncTime', 'accountEnabled', 'department', 'lastPasswordChangeDateTime', 'jobTitle', 'mobile', 'dirSyncEnabled', 'strongAuthenticationDetail', 'userType')
44
+ fields = ('objectId', 'objectType', 'userPrincipalName', 'displayName', 'mail', 'lastDirSyncTime', 'accountEnabled', 'department', 'lastPasswordChangeDateTime', 'jobTitle', 'mobile', 'dirSyncEnabled', 'strongAuthenticationDetail', 'userType', 'searchableDeviceKey')
45
45
 
46
46
  class DevicesSchema(ma.Schema):
47
47
  class Meta:
@@ -323,7 +323,8 @@ def get_mfa():
323
323
  'has_app': has_app,
324
324
  'has_phonenr': has_phonenr,
325
325
  'has_fido': has_fido,
326
- 'strongAuthenticationDetail': user.strongAuthenticationDetail
326
+ 'strongAuthenticationDetail': user.strongAuthenticationDetail,
327
+ 'searchableDeviceKey': user.searchableDeviceKey
327
328
  })
328
329
  return jsonify(out)
329
330