Exemplo n.º 1
0
    def post(self, request: Request, *args, **kwargs) -> Response:
        try:
            token = request.META["HTTP_AUTHORIZATION"].split(" ", 1)[1]
        except (KeyError, IndexError):
            return self.respond(status=status.HTTP_400_BAD_REQUEST)

        state = request.data
        if not state:
            return self.respond(status=status.HTTP_400_BAD_REQUEST)

        key_id = jwt.peek_header(token).get("kid")
        if key_id:
            try:
                decoded_claims = authenticate_asymmetric_jwt(token, key_id)
                verify_claims(decoded_claims,
                              request.path,
                              request.GET,
                              method="POST")
            except AtlassianConnectValidationError:
                return self.respond(status=status.HTTP_400_BAD_REQUEST)

        data = JiraIntegrationProvider().build_integration(state)
        integration = ensure_integration("jira", data)

        # Sync integration metadata from Jira. This must be executed *after*
        # the integration has been installed on Jira as the access tokens will
        # not work until then.
        sync_metadata.apply_async(kwargs={"integration_id": integration.id},
                                  countdown=10)

        return self.respond()
Exemplo n.º 2
0
    def post(self, request, *args, **kwargs):
        state = request.DATA
        data = JiraIntegrationProvider().build_integration(state)
        integration = ensure_integration('jira', data)

        # Sync integration metadata from Jira. This msut be executed *after*
        # the integration has been isntalled on Jira as the access tokens will
        # not work until then.
        sync_metadata.apply_async([integration.get_installation(None)], countdown=10)

        return self.respond()
Exemplo n.º 3
0
    def post(self, request, *args, **kwargs):
        state = request.data

        if not state:
            return self.respond(status=status.HTTP_400_BAD_REQUEST)

        data = JiraIntegrationProvider().build_integration(state)
        integration = ensure_integration("jira", data)

        # Sync integration metadata from Jira. This must be executed *after*
        # the integration has been installed on Jira as the access tokens will
        # not work until then.
        sync_metadata.apply_async(kwargs={"integration_id": integration.id},
                                  countdown=10)

        return self.respond()
Exemplo n.º 4
0
    def post(self, request: Request, *args, **kwargs) -> Response:
        token = self.get_token(request)

        state = request.data
        if not state:
            return self.respond(status=status.HTTP_400_BAD_REQUEST)

        key_id = jwt.peek_header(token).get("kid")
        if key_id:
            decoded_claims = authenticate_asymmetric_jwt(token, key_id)
            verify_claims(decoded_claims, request.path, request.GET, method="POST")

        data = JiraIntegrationProvider().build_integration(state)
        integration = ensure_integration(self.provider, data)

        # Sync integration metadata from Jira. This must be executed *after*
        # the integration has been installed on Jira as the access tokens will
        # not work until then.
        sync_metadata.apply_async(kwargs={"integration_id": integration.id}, countdown=10)

        return self.respond()
Exemplo n.º 5
0
    def post(self, request: Request, *args, **kwargs) -> Response:
        state = request.data
        data = BitbucketIntegrationProvider().build_integration(state)
        ensure_integration("bitbucket", data)

        return self.respond()
Exemplo n.º 6
0
    def post(self, request, *args, **kwargs):
        state = request.DATA
        data = BitbucketIntegrationProvider().build_integration(state)
        ensure_integration('bitbucket', data)

        return self.respond()
    def post(self, request, *args, **kwargs):
        state = request.DATA
        data = BitbucketIntegrationProvider().build_integration(state)
        ensure_integration('bitbucket', data)

        return self.respond()