Unverified Commit 5a338bab authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

Merge pull request #206598 from dennajort/gimme-aws-creds-2.4.4

parents 873c0ee9 d72c372c
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -3601,6 +3601,13 @@
    githubId = 62989;
    name = "Demyan Rogozhin";
  };
  dennajort = {
    email = "gosselinjb@gmail.com";
    matrix = "@dennajort:matrix.org";
    github = "dennajort";
    githubId = 1536838;
    name = "Jean-Baptiste Gosselin";
  };
  derchris = {
    email = "derchris@me.com";
    github = "derchrisuk";
+71 −0
Original line number Diff line number Diff line
{ lib
, buildPythonPackage
, fetchPypi
, pythonRelaxDepsHook
, setuptools-scm
# install requirements
, fido2
, keyring
, cryptography
# test requirements
, pytestCheckHook
}:

let
  fido2_0 = fido2.overridePythonAttrs (oldAttrs: rec {
    version = "0.9.3";
    src = fetchPypi {
      inherit (oldAttrs) pname;
      inherit version;
      hash = "sha256-tF6JphCc/Lfxu1E3dqotZAjpXEgi+DolORi5RAg0Zuw=";
    };
  });
in
buildPythonPackage rec {
  pname = "ctap-keyring-device";
  version = "1.0.6";

  src = fetchPypi {
    inherit version pname;
    sha256 = "sha256-pEJkuz0wxKt2PkowmLE2YC+HPYa2ZiENK7FAW14Ec/Y=";
  };

  # removing optional dependency needing pyobjc
  postPatch = ''
    substituteInPlace pytest.ini \
      --replace "--flake8 --black --cov" ""
  '';

  nativeBuildInputs = [
    pythonRelaxDepsHook
    setuptools-scm
  ];

  pythonRemoveDeps = [
    # This is a darwin requirement missing pyobjc
    "pyobjc-framework-LocalAuthentication"
  ];

  propagatedBuildInputs = [
    keyring
    fido2_0
    cryptography
  ];

  pythonImportsCheck = [ "ctap_keyring_device" ];

  checkInputs = [ pytestCheckHook ];

  disabledTests = [
    # Disabled tests that needs pyobjc or windows
    "touch_id_ctap_user_verifier"
    "windows_hello_ctap_user_verifier"
  ];

  meta = with lib; {
    description = "CTAP (client-to-authenticator-protocol) device backed by python's keyring library";
    homepage = "https://github.com/dany74q/ctap-keyring-device";
    license = licenses.mit;
    maintainers = with maintainers; [ dennajort ];
  };
}
+74 −0
Original line number Diff line number Diff line
{ lib
, stdenv
, buildPythonPackage
, fetchPypi
# install requirements
, pycryptodome
, yarl
, flatdict
, python-jose
, aenum
, aiohttp
, pydash
, xmltodict
, pyyaml
# test requirements
, pytestCheckHook
, pytest-recording
, pytest-asyncio
, pytest-mock
, pyfakefs
}:

buildPythonPackage rec {
  pname = "okta";
  version = "2.8.0";

  src = fetchPypi {
    inherit pname version;
    sha256 = "sha256-yIVJoKX9b9Y7Ydl28twHxgPbUa58LJ12Oz3tvpU7CAc=";
  };

  propagatedBuildInputs = [
    pycryptodome
    yarl
    flatdict
    python-jose
    aenum
    aiohttp
    pydash
    xmltodict
    pyyaml
  ];

  checkInputs = [
    pytestCheckHook
    pytest-asyncio
    pytest-mock
    pytest-recording
    pyfakefs
  ];

  pytestFlagsArray = [ "tests/" ];

  disabledTests = [
    "test_client_raise_exception"
  ];

  pythonImportsCheck = [
    "okta"
    "okta.cache"
    "okta.client"
    "okta.exceptions"
    "okta.http_client"
    "okta.models"
    "okta.request_executor"
  ];

  meta = with lib; {
    description = "Python SDK for the Okta Management API";
    homepage = "https://github.com/okta/okta-sdk-python";
    license = licenses.asl20;
    maintainers = with maintainers; [ dennajort ];
  };
}
+64 −0
Original line number Diff line number Diff line
{ lib
, stdenv
, buildPythonPackage
, fetchFromGitHub
# install dependencies
, pytest
, vcrpy
, attrs
# test dependencies
, pytestCheckHook
, pytest-httpbin
, pytest-mock
, requests
}:

buildPythonPackage rec {
  pname = "pytest-recording";
  version = "0.12.2";

  src = fetchFromGitHub {
    owner = "kiwicom";
    repo = "pytest-recording";
    rev = "v${version}";
    hash = "sha256-nivwxaW8AIrBtPkzPJYfxlPxWn2NuYcaMry/IrBnnl0=";
  };

  buildInputs = [
    pytest
  ];

  propagatedBuildInputs = [
    vcrpy
    attrs
  ];

  checkInputs = [
    pytestCheckHook
    pytest-httpbin
    pytest-mock
    requests
  ];

  disabledTests = [
    "test_block_network_with_allowed_hosts"
  ] ++ lib.optionals stdenv.isDarwin [
    # Missing socket.AF_NETLINK
    "test_other_socket"
  ];

  pytestFlagsArray = [
    "tests"
  ];

  pythonImportsCheck = [
    "pytest_recording"
  ];

  meta = with lib; {
    description = "A pytest plugin that allows you recording of network interactions via VCR.py";
    homepage = "https://github.com/kiwicom/pytest-recording";
    license = licenses.mit;
    maintainers = with maintainers; [ dennajort ];
  };
}
+106 −0
Original line number Diff line number Diff line
{ lib
, python3
, fetchFromGitHub
, nix-update-script
, testers
, gimme-aws-creds
}:

let
  python = python3.override {
    packageOverrides = self: super: {
      fido2 = super.fido2.overridePythonAttrs (oldAttrs: rec {
        version = "0.9.3";
        src = self.fetchPypi {
          inherit (oldAttrs) pname;
          inherit version;
          hash = "sha256-tF6JphCc/Lfxu1E3dqotZAjpXEgi+DolORi5RAg0Zuw=";
        };
      });

      okta = super.okta.overridePythonAttrs (oldAttrs: rec {
        version = "0.0.4";
        src = self.fetchPypi {
          inherit (oldAttrs) pname;
          inherit version;
          hash = "sha256-U+eSxo02hP9BQLTLHAKvOCEJA2j4EQ/eVMC9tjhEkzI=";
        };
        propagatedBuildInputs = [
          self.six
          self.python-dateutil
          self.requests
        ];
        pythonImportsCheck = [ "okta" ];
        doCheck = false; # no tests were included with this version
      });
    };
  };
in
python.pkgs.buildPythonApplication rec {
  pname = "gimme-aws-creds";
  version = "2.5.0"; # N.B: if you change this, check if overrides are still up-to-date
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "Nike-Inc";
    repo = "gimme-aws-creds";
    rev = "v${version}";
    hash = "sha256-rU4guBXRRJOG3/JilvEF9DwXM5z2IUV80qj3YcV8Z/I=";
  };

  nativeBuildInputs = with python.pkgs; [
    pythonRelaxDepsHook
  ];

  pythonRemoveDeps = [
    "configparser"
  ];

  propagatedBuildInputs = with python.pkgs; [
    boto3
    fido2
    beautifulsoup4
    ctap-keyring-device
    requests
    okta
  ];

  checkInputs = with python.pkgs; [
    pytestCheckHook
    nose
    responses
  ];

  disabledTests = [
    "test_build_factor_name_webauthn_registered"
  ];

  pythonImportsCheck = [
    "gimme_aws_creds"
  ];

  postInstall = ''
    rm $out/bin/gimme-aws-creds.cmd
    chmod +x $out/bin/gimme-aws-creds
  '';

  passthru = {
    inherit python;
    updateScript = nix-update-script {
      attrPath = pname;
    };
    tests.version = testers.testVersion {
      package = gimme-aws-creds;
      command = ''touch tmp.conf && OKTA_CONFIG="tmp.conf" gimme-aws-creds --version'';
      version = "gimme-aws-creds ${version}";
    };
  };

  meta = with lib; {
    homepage = "https://github.com/Nike-Inc/gimme-aws-creds";
    changelog = "https://github.com/Nike-Inc/gimme-aws-creds/releases";
    description = "A CLI that utilizes Okta IdP via SAML to acquire temporary AWS credentials";
    license = licenses.asl20;
    maintainers = with maintainers; [ dennajort ];
  };
}
Loading