├── .clog.toml ├── .github └── workflows │ └── test.yml ├── .gitignore ├── .travis.yml ├── .travis ├── install-kcov.sh └── run-kcov.sh ├── CONTRIBUTING.md ├── CONTRIBUTORS ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── coverage.sh ├── etc └── sublime-text │ └── yup-oauth2-rs.sublime-project ├── examples ├── Sanguine-69411a0c0eea.json ├── custom_client.rs ├── custom_flow.rs ├── custom_storage.rs ├── service_account_impersonation.rs ├── test-adc │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── test-device │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── test-installed │ ├── Cargo.toml │ └── src │ │ └── main.rs └── test-svc-acct │ ├── Cargo.toml │ └── src │ └── main.rs ├── rustfmt.toml ├── src ├── access_token.rs ├── application_default_credentials.rs ├── authenticator.rs ├── authenticator_delegate.rs ├── authorized_user.rs ├── client.rs ├── device.rs ├── error.rs ├── external_account.rs ├── helper.rs ├── installed.rs ├── lib.rs ├── refresh.rs ├── service_account.rs ├── service_account_impersonator.rs ├── storage.rs └── types.rs └── tests └── tests.rs /.clog.toml: -------------------------------------------------------------------------------- 1 | [clog] 2 | repository = "https://github.com/Byron/yup-oauth2" 3 | from-latest-tag = true 4 | 5 | [sections] 6 | Improvements = ["imp"] 7 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | on: [push, pull_request] 2 | 3 | name: Actions CI 4 | 5 | jobs: 6 | build_and_test: 7 | name: Run tests 8 | runs-on: ubuntu-latest 9 | strategy: 10 | fail-fast: false 11 | matrix: 12 | features: ["service_account,hyper-rustls,ring", 13 | "service_account,hyper-rustls,aws-lc-rs", 14 | "service_account,hyper-tls,ring", "service_account,hyper-tls,aws-lc-rs", 15 | "hyper-rustls,ring"] 16 | steps: 17 | - uses: actions/checkout@v4 18 | - uses: dtolnay/rust-toolchain@stable 19 | with: 20 | toolchain: stable 21 | - run: cargo test --no-default-features --features ${{ matrix.features }} 22 | 23 | doc: 24 | name: Create docs 25 | runs-on: ubuntu-latest 26 | steps: 27 | - uses: actions/checkout@v4 28 | - uses: dtolnay/rust-toolchain@stable 29 | with: 30 | toolchain: nightly 31 | - run: cargo doc --no-deps --all-features 32 | env: 33 | RUSTDOCFLAGS: --cfg docsrs -D warnings 34 | 35 | fmt: 36 | name: Check formatting 37 | runs-on: ubuntu-latest 38 | steps: 39 | - uses: actions/checkout@v4 40 | - uses: dtolnay/rust-toolchain@stable 41 | with: 42 | toolchain: stable 43 | - run: cargo fmt -- --check 44 | 45 | clippy: 46 | name: Run clippy lints 47 | runs-on: ubuntu-latest 48 | steps: 49 | - uses: actions/checkout@v4 50 | - uses: dtolnay/rust-toolchain@stable 51 | with: 52 | toolchain: stable 53 | components: clippy 54 | - run: cargo clippy --all-features --all-targets -- -D warnings 55 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | Cargo.lock 3 | *.sublime-workspace 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | os: 2 | - linux 3 | - osx 4 | dist: xenial 5 | sudo: false 6 | addons: 7 | apt: 8 | packages: 9 | # necessary for kcov 10 | - libcurl4-openssl-dev 11 | - libelf-dev 12 | - libdw-dev 13 | - libiberty-dev 14 | - binutils-dev 15 | - cmake 16 | - gcc 17 | 18 | language: rust 19 | rust: 20 | - stable 21 | - nightly 22 | 23 | stages: 24 | - name: test 25 | - name: lint 26 | - name: coverage 27 | 28 | install: true 29 | 30 | # Default script is the "test" stage 31 | script: 32 | - cargo build 33 | - cargo test 34 | 35 | jobs: 36 | include: 37 | - stage: lint 38 | if: os = linux 39 | rust: stable 40 | install: 41 | - rustup component add rustfmt 42 | script: 43 | - cargo fmt --all -- --check 44 | 45 | - stage: coverage 46 | if: os = linux 47 | sudo: true 48 | rust: stable 49 | env: 50 | - RUSTFLAGS="-C link-dead-code -C debuginfo=2 -C opt-level=0" 51 | - CACHE_NAME="coverage" 52 | install: 53 | - ./.travis/install-kcov.sh "v36" "29ccdde3bd44f14e0d7c88d709e1e5ff9b448e735538ae45ee08b73c19a2ea0b" && export PATH="kcov/usr/bin:${PATH}"; 54 | script: 55 | - cargo test --no-run 56 | - ./.travis/run-kcov.sh "yup_oauth2" 57 | - bash <(curl -s https://codecov.io/bash) -F "${TRAVIS_RUST_VERSION}" 58 | 59 | cache: cargo 60 | -------------------------------------------------------------------------------- /.travis/install-kcov.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o verbose 4 | set -o errexit 5 | set -o pipefail 6 | 7 | KCOV_VERSION="${1}" 8 | KCOV_SHA256_HASH="${2}" 9 | 10 | curl -L --output "kcov.tar.gz" "https://github.com/SimonKagstrom/kcov/archive/${KCOV_VERSION}.tar.gz" 11 | sha256sum "kcov.tar.gz" 12 | echo "${KCOV_SHA256_HASH} kcov.tar.gz" | sha256sum -c 13 | 14 | mkdir kcov-src 15 | mkdir kcov 16 | 17 | cd kcov-src 18 | tar -xf ../kcov.tar.gz --strip-components=1 19 | rm ../kcov.tar.gz 20 | 21 | mkdir build 22 | cd build 23 | cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr .. 24 | make -j 2 25 | make install DESTDIR=../../kcov 26 | cd ../../ 27 | rm -r kcov-src 28 | 29 | echo "kcov should not be available via 'kcov/usr/bin/kcov'" 30 | -------------------------------------------------------------------------------- /.travis/run-kcov.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o verbose 4 | set -o errexit 5 | set -o pipefail 6 | 7 | PROGRAM_NAME="${1}" 8 | 9 | echo "Coverage testing of ${PROGRAM_NAME}" 10 | 11 | for file in target/debug/${PROGRAM_NAME}-*; do 12 | [ -x "${file}" ] || continue 13 | mkdir -p "target/cov/$(basename ${file})"; 14 | kcov --exclude-pattern='/.cargo,/usr/lib' --verify "target/cov/$(basename ${file})" "${file}"; 15 | done 16 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Issues 2 | 3 | All issues, may it be feature requests, or bugs, are treated as **problems**. 4 | In any case it is important to be able to reproduce or understand it. To help in doing so, please state the following information: 5 | 6 | * a description of the problem 7 | * steps to reproduce the problem (if applicable) 8 | * library version showing the problem (if applicable) 9 | 10 | The emphasis on the term **problem** originates from the observed tendency of issues being more like a solution to a problem, 11 | which is not stated in detail, making good solutions more difficult to achieve. 12 | 13 | ## Pull Requests 14 | 15 | Feel free to make any kind of Pull Request - all contributions are welcome. 16 | 17 | The only thing to keep in mind is the commit message format, which is described below. 18 | 19 | ### Commit Message Format 20 | 21 | The format is taken directly from [angular.js][angular-contribution-guide], as is this text. 22 | 23 | Each commit message consists of a **header**, a **body** and a **footer**. The header has a special 24 | format that includes a **type**, a **scope** and a **subject**: 25 | 26 | ``` 27 | (): 28 | 29 | 30 | 31 |