示例#1
0
    def _get_project_key(self, request):
        dsn = request.GET.get('dsn')
        try:
            key = ProjectKey.from_dsn(dsn)
        except ProjectKey.DoesNotExist:
            return

        return key
示例#2
0
    def _get_project_key(self, request):
        dsn = request.GET.get('dsn')
        try:
            key = ProjectKey.from_dsn(dsn)
        except ProjectKey.DoesNotExist:
            return

        return key
示例#3
0
    def _get_project_key(self, request):
        try:
            dsn = request.GET['dsn']
        except KeyError:
            return

        try:
            key = ProjectKey.from_dsn(dsn)
        except ProjectKey.DoesNotExist:
            return

        return key
示例#4
0
    def _get_project_key(self, request):
        try:
            dsn = request.GET['dsn']
        except KeyError:
            return

        try:
            key = ProjectKey.from_dsn(dsn)
        except ProjectKey.DoesNotExist:
            return

        return key
示例#5
0
    def authenticate_credentials(self, token):
        try:
            key = ProjectKey.from_dsn(token)
        except ProjectKey.DoesNotExist:
            raise AuthenticationFailed('Invalid token')

        if not key.is_active:
            raise AuthenticationFailed('Invalid token')

        with configure_scope() as scope:
            scope.set_tag("api_token_type", self.token_name)
            scope.set_tag("api_project_key", key.id)

        return (AnonymousUser(), key)
示例#6
0
    def authenticate_credentials(self, token):
        try:
            key = ProjectKey.from_dsn(token)
        except ProjectKey.DoesNotExist:
            raise AuthenticationFailed('Invalid token')

        if not key.is_active:
            raise AuthenticationFailed('Invalid token')

        with configure_scope() as scope:
            scope.set_tag("api_token_type", self.token_name)
            scope.set_tag("api_project_key", key.id)

        return (AnonymousUser(), key)
示例#7
0
    def authenticate_credentials(self, token):
        from django.contrib.auth.models import AnonymousUser  # Django 1.9 setup issue
        from sentry.models import ProjectKey  # Django 1.9 setup issue
        try:
            key = ProjectKey.from_dsn(token)
        except ProjectKey.DoesNotExist:
            raise AuthenticationFailed('Invalid token')

        if not key.is_active:
            raise AuthenticationFailed('Invalid token')

        with configure_scope() as scope:
            scope.set_tag("api_token_type", self.token_name)
            scope.set_tag("api_project_key", key.id)

        return (AnonymousUser(), key)