Exemple #1
0
    def create_client(
            self, name=None, redirect_uri=None, company_name=None,
            company_url=None, contact_person=None, contact_type=None,
            email=None, phone=None, other_info=None, definition=None,
            client_id=None, client_secret=None, require_pkce_verification=None,
            jwks_uri=None, encryption_db=None, encryption_cert=None):
        data = DataObject()
        data.add_value_string("name", name)
        data.add_value("redirectUri", redirect_uri)
        data.add_value_string("companyName", company_name)
        data.add_value_string("companyUrl", company_url)
        data.add_value_string("contactPerson", contact_person)
        data.add_value_string("contactType", contact_type)
        data.add_value_string("email", email)
        data.add_value_string("phone", phone)
        data.add_value_string("otherInfo", other_info)
        data.add_value_string("definition", definition)
        data.add_value_string("clientId", client_id)
        data.add_value_string("clientSecret", client_secret)
        data.add_value_boolean("requirePkce", require_pkce_verification)
        data.add_value_string("jwksUri", jwks_uri)
        data.add_value_string("encryptionDb", encryption_db)
        data.add_value_string("encryptioncert", encryption_cert)

        response = self.client.post_json(CLIENTS, data.data)
        response.success = response.status_code == 201

        return response
    def enable(self, enforce=False):
        data = DataObject()
        data.add_value_boolean("enforcing", enforce)
        endpoint = MANAGEMENT_AUTHORIZATION + '/config/v1'
        response = self.client.put_json(endpoint, data.data)
        response.success = response.status_code == 204

        return response
Exemple #3
0
    def configure_api_protection(self,
                                 webseal_id,
                                 hostname=None,
                                 port=None,
                                 username=None,
                                 password=None,
                                 reuse_certs=None,
                                 reuse_acls=None,
                                 api=None,
                                 browser=None,
                                 junction=None):
        data = DataObject()
        data.add_value_string("hostname", hostname)
        data.add_value_string("username", username)
        data.add_value_string("password", password)
        data.add_value("port", port)
        data.add_value("junction", junction if junction != None else "/mga")

        data.add_value_boolean("reuse_certs", reuse_certs)
        data.add_value_boolean("reuse_acls", reuse_acls)
        data.add_value_boolean("api", api)
        data.add_value_boolean("browser", browser)

        endpoint = "%s/%s/oauth_config" % (REVERSEPROXY, webseal_id)

        response = self.client.post_json(endpoint, data.data)
        response.success = response.status_code == 204
        return response
    def update(self, enforce_config=False, roles=[]):
        auth_config = DataObject()
        auth_config.add_value_boolean("enforcing", enforce_config)

        auth_roles = DataObject()
        auth_roles.add_value_not_empty("roles", roles)

        data = DataObject()
        data.add_value("config", auth_config.data)
        data.add_value_not_empty("roles", auth_roles.data)
        endpoint = MANAGEMENT_AUTHORIZATION + '/v1'
        response = self.client.post_json(endpoint, data.data)
        response.success = response.status_code == 200

        return response
Exemple #5
0
    def update(self, name, allowed_origins=[], allow_credentials=None, exposed_headers=[],
            handle_preflight=None, allowed_methods=[], allowed_headers=[], max_age=None):
        data = DataObject()
        data.add_value_not_empty("allowed_origins", allowed_origins)
        data.add_value_boolean("allow_credentials", allow_credentials)
        data.add_value_not_empty("exposed_headers", exposed_headers)
        data.add_value_boolean("handle_preflight", handle_preflight)
        data.add_value_not_empty("alowed_methods", allowed_methods)
        data.add_value_not_empty("alowed_headers", allowed_headers)
        data.add_value("max_age", max_age)

        endpoint = CORS_POLICY + "/{}".format(name)
        response = self.client.put_json(endpoint, data.data)
        response.success = response.status_code == 200

        return response