コード例 #1
0
ファイル: auth.py プロジェクト: 1979139113/poc_exp
    def authenticateKey(self, app, credentials):
        assert isinstance(app, Factory)
        assert ISSHPrivateKey.providedBy(credentials)

        key = Key.fromString(credentials.blob)
        fingerprint = key.fingerprint().replace(':', '')

        service = None
        data = {}

        if credentials.username == "git":
            service = Service(
                self.protocol(app.getConfig(), 'drupalorg-sshkey-check'))

            data = {"fingerprint": fingerprint}

            service.request_bool(data)
        else:
            service = Service(
                self.protocol(app.getConfig(), 'drupalorg-ssh-user-key'))

            data = {
                "username": credentials.username,
                "fingerprint": fingerprint
            }

            service.request_bool(data)

        service.addCallback(self._handleProtocolCallback, app, data)

        return service.deferred
コード例 #2
0
ファイル: auth.py プロジェクト: pacodiasse/gitexd-drupalorg
    def authenticatePassword(self, app, credentials):
        assert isinstance(app, Factory)
        assert IUsernamePassword.providedBy(credentials)

        service = Service(self.protocol(app.getConfig(), "drupalorg-vcs-auth-fetch-user-hash"))
        service.request_json({"username": credentials.username})

        def _authCallback(result):
            if result:
                service = Service(self.protocol(app.getConfig(), "drupalorg-vcs-auth-check-user-pass"))

                data = {
                    "username": credentials.username,
                    "password": DrupalHash(result, credentials.password).get_hash(),
                }

                service.request_bool(data)

                service.addCallback(self._handleProtocolCallback, app, data)

                return service.deferred
            else:
                return None

        service.addCallback(_authCallback)

        return service.deferred
コード例 #3
0
ファイル: auth.py プロジェクト: 1979139113/poc_exp
    def _handleProtocolCallback(self, result, app, data):
        assert isinstance(app, Factory)
        assert isinstance(data, dict)

        if result:
            authService = Service(
                self.protocol(app.getConfig(), 'vcs-auth-data'))
            pushctlService = Service(
                self.protocol(app.getConfig(), 'pushctl-state'))

            return Session(app, authService, pushctlService, data)
        else:
            return None
コード例 #4
0
ファイル: auth.py プロジェクト: pacodiasse/gitexd-drupalorg
    def authenticateKey(self, app, credentials):
        assert isinstance(app, Factory)
        assert ISSHPrivateKey.providedBy(credentials)

        key = Key.fromString(credentials.blob)
        fingerprint = key.fingerprint().replace(":", "")

        service = None
        data = {}

        if credentials.username == "git":
            service = Service(self.protocol(app.getConfig(), "drupalorg-sshkey-check"))

            data = {"fingerprint": fingerprint}

            service.request_bool(data)
        else:
            service = Service(self.protocol(app.getConfig(), "drupalorg-ssh-user-key"))

            data = {"username": credentials.username, "fingerprint": fingerprint}

            service.request_bool(data)

        service.addCallback(self._handleProtocolCallback, app, data)

        return service.deferred
コード例 #5
0
ファイル: auth.py プロジェクト: pacodiasse/gitexd-drupalorg
        def _authCallback(result):
            if result:
                service = Service(self.protocol(app.getConfig(), "drupalorg-vcs-auth-check-user-pass"))

                data = {
                    "username": credentials.username,
                    "password": DrupalHash(result, credentials.password).get_hash(),
                }

                service.request_bool(data)

                service.addCallback(self._handleProtocolCallback, app, data)

                return service.deferred
            else:
                return None
コード例 #6
0
ファイル: auth.py プロジェクト: 1979139113/poc_exp
    def allowAnonymousAccess(self, app):
        assert isinstance(app, Factory)

        if app.getConfig().get("DEFAULT", "allowAnonymous", True):
            service = Service(self.protocol(app.getConfig(), 'vcs-auth-data'))

            return defer.succeed(AnonymousSession(app, service))
        else:
            return defer.succeed(None)
コード例 #7
0
ファイル: auth.py プロジェクト: 1979139113/poc_exp
    def authenticatePassword(self, app, credentials):
        assert isinstance(app, Factory)
        assert IUsernamePassword.providedBy(credentials)

        service = Service(
            self.protocol(app.getConfig(),
                          'drupalorg-vcs-auth-fetch-user-hash'))
        service.request_json({"username": credentials.username})

        def _authCallback(result):
            if result:
                service = Service(
                    self.protocol(app.getConfig(),
                                  'drupalorg-vcs-auth-check-user-pass'))

                data = {
                    "username": credentials.username,
                    "password": DrupalHash(result,
                                           credentials.password).get_hash()
                }

                service.request_bool(data)

                service.addCallback(self._handleProtocolCallback, app, data)

                return service.deferred
            else:
                return None

        service.addCallback(_authCallback)

        return service.deferred
コード例 #8
0
ファイル: auth.py プロジェクト: 1979139113/poc_exp
        def _authCallback(result):
            if result:
                service = Service(
                    self.protocol(app.getConfig(),
                                  'drupalorg-vcs-auth-check-user-pass'))

                data = {
                    "username": credentials.username,
                    "password": DrupalHash(result,
                                           credentials.password).get_hash()
                }

                service.request_bool(data)

                service.addCallback(self._handleProtocolCallback, app, data)

                return service.deferred
            else:
                return None