Skip to content

Commit

Permalink
Merge pull request #290 from dart-lang/merge-oauth2-package
Browse files Browse the repository at this point in the history
Merge `oauth2` package
  • Loading branch information
mosuem authored Aug 21, 2024
2 parents d3b92b1 + 032078c commit bc35f17
Show file tree
Hide file tree
Showing 27 changed files with 3,590 additions and 0 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/oauth2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Dart CI

on:
# Run on PRs and pushes to the default branch.
push:
branches: [ main ]
paths:
- '.github/workflows/oauth2.yml'
- 'pkgs/oauth2/**'
pull_request:
branches: [ main ]
paths:
- '.github/workflows/oauth2.yml'
- 'pkgs/oauth2/**'
schedule:
- cron: "0 0 * * 0"

env:
PUB_ENVIRONMENT: bot.github

jobs:
# Check code formatting and lints against Dart dev, check analyzer warnings
# against the oldest supported SDK.
analyze:
runs-on: ubuntu-latest
defaults:
run:
working-directory: pkgs/oauth2/
strategy:
fail-fast: false
matrix:
sdk: [3.0.0, dev]
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
with:
sdk: ${{ matrix.sdk }}
- id: install
name: Install dependencies
run: dart pub get
- name: Check formatting
run: dart format --output=none --set-exit-if-changed .
if: matrix.sdk == 'dev' && steps.install.outcome == 'success'
- name: Analyze code
run: dart analyze --fatal-infos
if: matrix.sdk == 'dev' && steps.install.outcome == 'success'
- name: Analyze code
run: dart analyze
if: matrix.sdk != 'dev' && steps.install.outcome == 'success'

# Run tests on a matrix consisting of two dimensions:
# 1. OS: ubuntu-latest, (macos-latest, windows-latest)
# 2. release channel: dev
test:
needs: analyze
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: pkgs/oauth2/
strategy:
fail-fast: false
matrix:
# Add macos-latest and/or windows-latest if relevant for this package.
os: [ubuntu-latest]
sdk: [stable, beta]
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
with:
sdk: ${{ matrix.sdk }}
- id: install
name: Install dependencies
run: dart pub get
- name: Run VM tests
run: dart test --platform vm
if: always() && steps.install.outcome == 'success'
- name: Run Chrome tests
run: dart test --platform chrome
if: always() && steps.install.outcome == 'success'
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ don't naturally belong to other topic monorepos (like
| [graphs](pkgs/graphs/) | Graph algorithms that operate on graphs in any representation | [![pub package](https://img.shields.io/pub/v/graphs.svg)](https://pub.dev/packages/graphs) |
| [unified_analytics](pkgs/unified_analytics/) | A package for logging analytics for all Dart and Flutter related tooling to Google Analytics. | [![pub package](https://img.shields.io/pub/v/unified_analytics.svg)](https://pub.dev/packages/unified_analytics) |
| [source_map_stack_trace](pkgs/source_map_stack_trace/) | A package for applying source maps to stack traces. | [![pub package](https://img.shields.io/pub/v/source_map_stack_trace.svg)](https://pub.dev/packages/source_map_stack_trace) |
| [oauth2](pkgs/oauth2/) | A client library for authenticatingand making requests via OAuth2. | [![pub package](https://img.shields.io/pub/v/oauth2.svg)](https://pub.dev/packages/oauth2) |

## Publishing automation

Expand Down
16 changes: 16 additions & 0 deletions pkgs/oauth2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Don’t commit the following directories created by pub.
.buildlog
.pub/
.dart_tool/
build/
packages
.packages

# Or the files created by dart2js.
*.dart.js
*.js_
*.js.deps
*.js.map

# Include when developing application packages.
pubspec.lock
131 changes: 131 additions & 0 deletions pkgs/oauth2/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
## 2.0.3

* Require `package:http` v1.0.0
* Move to `dart-lang/tools`.

## 2.0.2

* Require Dart 3.0.
* Support `package:http` 1.0.0.

## 2.0.1

* Handle `expires_in` when encoded as string.
* Populate the pubspec `repository` field.
* Increase the minimum Dart SDK to `2.17.0`.

## 2.0.0

* Migrate to null safety.

## 1.6.3

* Added optional `codeVerifier` parameter to `AuthorizationCodeGrant` constructor.

## 1.6.1

* Added fix to make sure that credentials are only refreshed once when multiple calls are made.

## 1.6.0

* Added PKCE support to `AuthorizationCodeGrant`.

## 1.5.0

* Added support for `clientCredentialsGrant`.

## 1.4.0

* OpenID's id_token treated.

## 1.3.0

* Added `onCredentialsRefreshed` option when creating `Client` objects.

## 1.2.3

* Support the latest `package:http` release.

## 1.2.2

* Allow the stable 2.0 SDK.

## 1.2.1

* Updated SDK version to 2.0.0-dev.17.0

## 1.2.0

* Add a `getParameter()` parameter to `new AuthorizationCodeGrant()`, `new
Credentials()`, and `resourceOwnerPasswordGrant()`. This controls how the
authorization server's response is parsed for servers that don't provide the
standard JSON response.

## 1.1.1

* `resourceOwnerPasswordGrant()` now properly uses its HTTP client for requests
made by the OAuth2 client it returns.

## 1.1.0

* Add a `delimiter` parameter to `new AuthorizationCodeGrant()`, `new
Credentials()`, and `resourceOwnerPasswordGrant()`. This controls the
delimiter between scopes, which some authorization servers require to be
different values than the specified `' '`.

## 1.0.2

* Fix all strong-mode warnings.
* Support `crypto` 1.0.0.
* Support `http_parser` 3.0.0.

## 1.0.1

* Support `http_parser` 2.0.0.

## 1.0.0

### Breaking changes

* Requests that use client authentication, such as the
`AuthorizationCodeGrant`'s access token request and `Credentials`' refresh
request, now use HTTP Basic authentication by default. This form of
authentication is strongly recommended by the OAuth 2.0 spec. The new
`basicAuth` parameter may be set to `false` to force form-based authentication
for servers that require it.

* `new AuthorizationCodeGrant()` now takes `secret` as an optional named
argument rather than a required argument. This matches the OAuth 2.0 spec,
which says that a client secret is only required for confidential clients.

* `new Client()` and `Credentials.refresh()` now take both `identifier` and
`secret` as optional named arguments rather than required arguments. This
matches the OAuth 2.0 spec, which says that the server may choose not to
require client authentication for some flows.

* `new Credentials()` now takes named arguments rather than optional positional
arguments.

### Non-breaking changes

* Added a `resourceOwnerPasswordGrant` method.

* The `scopes` argument to `AuthorizationCodeGrant.getAuthorizationUrl()` and
`new Credentials()` and the `newScopes` argument to `Credentials.refresh` now
take an `Iterable` rather than just a `List`.

* The `scopes` argument to `AuthorizationCodeGrant.getAuthorizationUrl()` now
defaults to `null` rather than `const []`.

# 0.9.3

* Update the `http` dependency.

* Since `http` 0.11.0 now works in non-`dart:io` contexts, `oauth2` does as
well.

## 0.9.2

* Expand the dependency on the HTTP package to include 0.10.x.

* Add a README file.
27 changes: 27 additions & 0 deletions pkgs/oauth2/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright 2014, the Dart project authors.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading

0 comments on commit bc35f17

Please sign in to comment.