Skip to content

Commit bc35f17

Browse files
authored
Merge pull request #290 from dart-lang/merge-oauth2-package
Merge `oauth2` package
2 parents d3b92b1 + 032078c commit bc35f17

27 files changed

+3590
-0
lines changed

.github/workflows/oauth2.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Dart CI
2+
3+
on:
4+
# Run on PRs and pushes to the default branch.
5+
push:
6+
branches: [ main ]
7+
paths:
8+
- '.github/workflows/oauth2.yml'
9+
- 'pkgs/oauth2/**'
10+
pull_request:
11+
branches: [ main ]
12+
paths:
13+
- '.github/workflows/oauth2.yml'
14+
- 'pkgs/oauth2/**'
15+
schedule:
16+
- cron: "0 0 * * 0"
17+
18+
env:
19+
PUB_ENVIRONMENT: bot.github
20+
21+
jobs:
22+
# Check code formatting and lints against Dart dev, check analyzer warnings
23+
# against the oldest supported SDK.
24+
analyze:
25+
runs-on: ubuntu-latest
26+
defaults:
27+
run:
28+
working-directory: pkgs/oauth2/
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
sdk: [3.0.0, dev]
33+
steps:
34+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
35+
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
36+
with:
37+
sdk: ${{ matrix.sdk }}
38+
- id: install
39+
name: Install dependencies
40+
run: dart pub get
41+
- name: Check formatting
42+
run: dart format --output=none --set-exit-if-changed .
43+
if: matrix.sdk == 'dev' && steps.install.outcome == 'success'
44+
- name: Analyze code
45+
run: dart analyze --fatal-infos
46+
if: matrix.sdk == 'dev' && steps.install.outcome == 'success'
47+
- name: Analyze code
48+
run: dart analyze
49+
if: matrix.sdk != 'dev' && steps.install.outcome == 'success'
50+
51+
# Run tests on a matrix consisting of two dimensions:
52+
# 1. OS: ubuntu-latest, (macos-latest, windows-latest)
53+
# 2. release channel: dev
54+
test:
55+
needs: analyze
56+
runs-on: ${{ matrix.os }}
57+
defaults:
58+
run:
59+
working-directory: pkgs/oauth2/
60+
strategy:
61+
fail-fast: false
62+
matrix:
63+
# Add macos-latest and/or windows-latest if relevant for this package.
64+
os: [ubuntu-latest]
65+
sdk: [stable, beta]
66+
steps:
67+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
68+
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
69+
with:
70+
sdk: ${{ matrix.sdk }}
71+
- id: install
72+
name: Install dependencies
73+
run: dart pub get
74+
- name: Run VM tests
75+
run: dart test --platform vm
76+
if: always() && steps.install.outcome == 'success'
77+
- name: Run Chrome tests
78+
run: dart test --platform chrome
79+
if: always() && steps.install.outcome == 'success'

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ don't naturally belong to other topic monorepos (like
1919
| [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) |
2020
| [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) |
2121
| [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) |
22+
| [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) |
2223

2324
## Publishing automation
2425

pkgs/oauth2/.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Don’t commit the following directories created by pub.
2+
.buildlog
3+
.pub/
4+
.dart_tool/
5+
build/
6+
packages
7+
.packages
8+
9+
# Or the files created by dart2js.
10+
*.dart.js
11+
*.js_
12+
*.js.deps
13+
*.js.map
14+
15+
# Include when developing application packages.
16+
pubspec.lock

pkgs/oauth2/CHANGELOG.md

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
## 2.0.3
2+
3+
* Require `package:http` v1.0.0
4+
* Move to `dart-lang/tools`.
5+
6+
## 2.0.2
7+
8+
* Require Dart 3.0.
9+
* Support `package:http` 1.0.0.
10+
11+
## 2.0.1
12+
13+
* Handle `expires_in` when encoded as string.
14+
* Populate the pubspec `repository` field.
15+
* Increase the minimum Dart SDK to `2.17.0`.
16+
17+
## 2.0.0
18+
19+
* Migrate to null safety.
20+
21+
## 1.6.3
22+
23+
* Added optional `codeVerifier` parameter to `AuthorizationCodeGrant` constructor.
24+
25+
## 1.6.1
26+
27+
* Added fix to make sure that credentials are only refreshed once when multiple calls are made.
28+
29+
## 1.6.0
30+
31+
* Added PKCE support to `AuthorizationCodeGrant`.
32+
33+
## 1.5.0
34+
35+
* Added support for `clientCredentialsGrant`.
36+
37+
## 1.4.0
38+
39+
* OpenID's id_token treated.
40+
41+
## 1.3.0
42+
43+
* Added `onCredentialsRefreshed` option when creating `Client` objects.
44+
45+
## 1.2.3
46+
47+
* Support the latest `package:http` release.
48+
49+
## 1.2.2
50+
51+
* Allow the stable 2.0 SDK.
52+
53+
## 1.2.1
54+
55+
* Updated SDK version to 2.0.0-dev.17.0
56+
57+
## 1.2.0
58+
59+
* Add a `getParameter()` parameter to `new AuthorizationCodeGrant()`, `new
60+
Credentials()`, and `resourceOwnerPasswordGrant()`. This controls how the
61+
authorization server's response is parsed for servers that don't provide the
62+
standard JSON response.
63+
64+
## 1.1.1
65+
66+
* `resourceOwnerPasswordGrant()` now properly uses its HTTP client for requests
67+
made by the OAuth2 client it returns.
68+
69+
## 1.1.0
70+
71+
* Add a `delimiter` parameter to `new AuthorizationCodeGrant()`, `new
72+
Credentials()`, and `resourceOwnerPasswordGrant()`. This controls the
73+
delimiter between scopes, which some authorization servers require to be
74+
different values than the specified `' '`.
75+
76+
## 1.0.2
77+
78+
* Fix all strong-mode warnings.
79+
* Support `crypto` 1.0.0.
80+
* Support `http_parser` 3.0.0.
81+
82+
## 1.0.1
83+
84+
* Support `http_parser` 2.0.0.
85+
86+
## 1.0.0
87+
88+
### Breaking changes
89+
90+
* Requests that use client authentication, such as the
91+
`AuthorizationCodeGrant`'s access token request and `Credentials`' refresh
92+
request, now use HTTP Basic authentication by default. This form of
93+
authentication is strongly recommended by the OAuth 2.0 spec. The new
94+
`basicAuth` parameter may be set to `false` to force form-based authentication
95+
for servers that require it.
96+
97+
* `new AuthorizationCodeGrant()` now takes `secret` as an optional named
98+
argument rather than a required argument. This matches the OAuth 2.0 spec,
99+
which says that a client secret is only required for confidential clients.
100+
101+
* `new Client()` and `Credentials.refresh()` now take both `identifier` and
102+
`secret` as optional named arguments rather than required arguments. This
103+
matches the OAuth 2.0 spec, which says that the server may choose not to
104+
require client authentication for some flows.
105+
106+
* `new Credentials()` now takes named arguments rather than optional positional
107+
arguments.
108+
109+
### Non-breaking changes
110+
111+
* Added a `resourceOwnerPasswordGrant` method.
112+
113+
* The `scopes` argument to `AuthorizationCodeGrant.getAuthorizationUrl()` and
114+
`new Credentials()` and the `newScopes` argument to `Credentials.refresh` now
115+
take an `Iterable` rather than just a `List`.
116+
117+
* The `scopes` argument to `AuthorizationCodeGrant.getAuthorizationUrl()` now
118+
defaults to `null` rather than `const []`.
119+
120+
# 0.9.3
121+
122+
* Update the `http` dependency.
123+
124+
* Since `http` 0.11.0 now works in non-`dart:io` contexts, `oauth2` does as
125+
well.
126+
127+
## 0.9.2
128+
129+
* Expand the dependency on the HTTP package to include 0.10.x.
130+
131+
* Add a README file.

pkgs/oauth2/LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright 2014, the Dart project authors.
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are
5+
met:
6+
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above
10+
copyright notice, this list of conditions and the following
11+
disclaimer in the documentation and/or other materials provided
12+
with the distribution.
13+
* Neither the name of Google LLC nor the names of its
14+
contributors may be used to endorse or promote products derived
15+
from this software without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)