def __init__(self, custos_server_setting):
        self.custos_settings = custos_server_setting
        self.target = self.custos_settings.CUSTOS_SERVER_HOST + ":" + str(self.custos_settings.CUSTOS_SERVER_PORT)
        self.url = "https://" + self.target + "/resource-secret-management/v1.0.0/secret"
        self.ownertype = "CUSTOS"
        self.resource_type = "SERVER_CERTIFICATE"
        self.params = {
            'metadata.owner_type': self.ownertype,
            'metadata.resource_type': self.resource_type
        }

        self.rootdir = os.path.abspath(os.curdir)
        encodedStr = utl.get_token(self.custos_settings)
        self.header = {'Authorization': 'Bearer {}'.format(encodedStr)}
Example #2
0
# load root directoty
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# get settings file path (settings file path reside in configs folder under home directory)
settings_path = os.path.join(BASE_DIR, 'configs', "settings.ini")

# read settings
custos_settings = CustosServerClientSettings(
    configuration_file_location=settings_path)

# create custos user management client
group_management_client = GroupManagementClient(custos_settings)

# obtain base 64 encoded token for tenant
b64_encoded_custos_token = utl.get_token(custos_settings=custos_settings)


def create_group(name, description, owner_id):
    response = group_management_client.create_groups(
        token=b64_encoded_custos_token,
        name=name,
        description=description,
        owner_id=owner_id)
    print(response)
    return response


def add_user_to_group(username, group_id, membership_type):
    response = group_management_client.add_user_to_group(
        token=b64_encoded_custos_token,
Example #3
0
import custos.clients.utils.utilities as utl

logger = logging.getLogger(__name__)

logger.setLevel(logging.DEBUG)
# create console handler with a higher log level
handler = logging.StreamHandler()
handler.setLevel(logging.DEBUG)

custos_settings = CustosServerClientSettings()
# load APIServerClient with default configuration
client = TenantManagementClient(custos_settings)
admin_client = SuperTenantManagementClient(custos_settings)
id_client = IdentityManagementClient(custos_settings)

token = utl.get_token(custos_settings)


def create_tenant():
    contacts = ["2345634324"]
    redirect_uris = [
        "http://*****:*****@iu.edu", "First Name", "LastName", "email", "admin",
        "1234", contacts, redirect_uris, "https://domain.org/",
        "openid profile email org.cilogon.userinfo", "domain.org",
        "https://domain.org/static/favicon.png", "Galaxy Portal")
    print(response)