Beispiel #1
0
 def __init__(self,
              server_account,
              server_passwd,
              server_addr='smtp.qiye.aliyun.com',
              server_port=465):
     self.lg = log.Logger("./log/ldap3_log.log", level="info")
     self.server_account = server_account
     self.server_passwd = server_passwd
     self.server_addr = server_addr
     self.server_port = server_port
Beispiel #2
0
 def __init__(self):
     self.lg = log.Logger("./log/ldap3_log.log", level="info")
     self.check = check.Check()
     self.search_base_users = "ou=users,dc=vickey-wu,dc=com"
     self.search_base_groups = "ou=groups,dc=vickey-wu,dc=com"
     self.ldap_approval_group = "administrators"
     self.ldap_tech_center_authorities = [
         "users", "gitlab-users", "backend-users"
     ]
     self.ldap_other_center_authorities = ["users"]
Beispiel #3
0
 def __init__(self):
     # Enum{0: 普通短信, 1: 营销短信}
     self.lg = log.Logger("./log/tencent_sms.log", level="info")
     self.sms_type = 0
     self.appid = sms_setting.APPID
     self.appkey = sms_setting.APPKEY
Beispiel #4
0
import json
import requests
from registration import log

lg = log.Logger('./log/keycloak_log.log', level='debug')


def get_keycloak_token(realm='test-realm'):
    data = {
        'client_id': 'admin-cli',
        'grant_type': 'password',
        'username': '******',
        'password': '******',
    }
    server_url = 'https://auth.vickey-wu.com/auth'

    token_url = '{}/realms/{}/protocol/openid-connect/token'.format(
        server_url, realm)
    req = requests.post(token_url, data=data)
    req_token = json.loads(req.text)['access_token']

    lg.logger.info('keycloak access token: {}'.format(req_token))
    return req_token


def add_realm_role_to_user(username, realm, role_name):
    #realm = 'test-realm'
    server_url = 'https://auth.vickey-wu.com/auth'
    req_token = get_keycloak_token(realm)

    headers = {
Beispiel #5
0
 def __init__(self):
     self.lg = log.Logger("./log/check_log.log", level="info")
Beispiel #6
0
 def __init__(self):
     self.access_token = self.__get_token()
     self.lg = log.Logger("./log/exmail_log.log",level="info")