Skip to content

Commit 97d860f

Browse files
authored
Merge pull request #684 from ruby-oauth/feat/improve-docs
2 parents 061ec4a + f2dbc27 commit 97d860f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+259
-151
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Please file a bug if you notice a violation of semantic versioning.
2020

2121
### Added
2222

23+
- [gh!683][gh!683] Improve documentation by @pboling
24+
2325
### Changed
2426

2527
### Deprecated
@@ -30,6 +32,8 @@ Please file a bug if you notice a violation of semantic versioning.
3032

3133
### Security
3234

35+
[gh!683]: https://github.com/ruby-oauth/oauth2/pull/683
36+
3337
## [2.0.17] - 2025-09-15
3438

3539
- TAG: [v2.0.17][2.0.17t]
@@ -41,6 +45,8 @@ Please file a bug if you notice a violation of semantic versioning.
4145

4246
- [gh!682][gh!682] - AccessToken: support Hash-based verb-dependent token transmission mode (e.g., {get: :query, post: :header})
4347

48+
[gh!682]: https://github.com/ruby-oauth/oauth2/pull/682
49+
4450
## [2.0.16] - 2025-09-14
4551

4652
- TAG: [v2.0.16][2.0.16t]

README.md

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ NOTE: `header` - The content type specified in the `curl` is already the default
6262
</details>
6363

6464
<details>
65-
<summary>Complete E2E single file script against [navikt/mock-oauth2-server](https://github.com/navikt/mock-oauth2-server)</summary>
65+
<summary>Complete E2E single file script against mock-oauth2-server</summary>
6666

67-
- E2E example using the mock test server added in v2.0.11
67+
- E2E example uses [navikt/mock-oauth2-server](https://github.com/navikt/mock-oauth2-server), which was added in v2.0.11
68+
- E2E example does not ship with the released gem, so clone the source to play with it.
6869

6970
```console
7071
docker compose -f docker-compose-ssl.yml up -d --wait
@@ -93,26 +94,26 @@ docker compose -f docker-compose-ssl.yml down
9394
Troubleshooting: validate connectivity to the mock server
9495

9596
- Check container status and port mapping:
96-
- docker compose -f docker-compose-ssl.yml ps
97+
- `docker compose -f docker-compose-ssl.yml ps`
9798
- From the host, try the discovery URL directly (this is what the example uses by default):
98-
- curl -v http://localhost:8080/default/.well-known/openid-configuration
99-
- If that fails immediately, also try: curl -v --connect-timeout 2 http://127.0.0.1:8080/default/.well-known/openid-configuration
100-
- From inside the container (to distinguish container vs host networking):
101-
- docker exec -it oauth2-mock-oauth2-server-1 curl -v http://127.0.0.1:8080/default/.well-known/openid-configuration
99+
- `curl -v http://localhost:8080/default/.well-known/openid-configuration`
100+
- If that fails immediately, also try: `curl -v --connect-timeout 2 http://127.0.0.1:8080/default/.well-known/openid-configuration`
101+
- From inside the container (to distinguish container vs. host networking):
102+
- `docker exec -it oauth2-mock-oauth2-server-1 curl -v http://127.0.0.1:8080/default/.well-known/openid-configuration`
102103
- Simple TCP probe from the host:
103-
- nc -vz localhost 8080 # or: ruby -rsocket -e 'TCPSocket.new("localhost",8080).close; puts "tcp ok"'
104+
- `nc -vz localhost 8080 # or: ruby -rsocket -e 'TCPSocket.new("localhost",8080).close; puts "tcp ok"'`
104105
- Inspect which host port 8080 is bound to (should be 8080):
105-
- docker inspect -f '{{ (index (index .NetworkSettings.Ports "8080/tcp") 0).HostPort }}' oauth2-mock-oauth2-server-1
106+
- `docker inspect -f '{{ (index (index .NetworkSettings.Ports "8080/tcp") 0).HostPort }}' oauth2-mock-oauth2-server-1`
106107
- Look at server logs for readiness/errors:
107-
- docker logs -n 200 oauth2-mock-oauth2-server-1
108+
- `docker logs -n 200 oauth2-mock-oauth2-server-1`
108109
- On Linux, ensure nothing else is bound to 8080 and that firewall/SELinux aren’t blocking:
109-
- ss -ltnp | grep :8080
110+
- `ss -ltnp | grep :8080`
110111

111112
Notes
112-
- Discovery URL pattern is: http://localhost:8080/<realm>/.well-known/openid-configuration, where <realm> defaults to "default".
113+
- Discovery URL pattern is: `http://localhost:8080/<realm>/.well-known/openid-configuration`, where `<realm>` defaults to `default`.
113114
- You can change these with env vars when running the example:
114-
- E2E_ISSUER_BASE (default: http://localhost:8080)
115-
- E2E_REALM (default: default)
115+
- `E2E_ISSUER_BASE` (default: http://localhost:8080)
116+
- `E2E_REALM` (default: default)
116117

117118
</details>
118119

@@ -144,7 +145,7 @@ If it seems like you are in the wrong place, you might try one of these:
144145

145146
### Compatibility
146147

147-
* Operating Systems: Linux, MacOS, Windows
148+
* Operating Systems: Linux, macOS, Windows
148149
* MRI Ruby @ v2.3, v2.4, v2.5, v2.6, v2.7, v3.0, v3.1, v3.2, v3.3, v3.4, HEAD
149150
* NOTE: This gem may still _install_ and _run_ on ruby v2.2, but vanilla GitHub Actions no longer supports testing against it, so YMMV. Accept patches so long as they don't break the platforms that do run in CI.
150151
* JRuby @ v9.4, v10.0, HEAD
@@ -213,7 +214,7 @@ The various versions of each are tested via the Ruby test matrix, along with wha
213214
* time
214215
* logger (removed from stdlib in Ruby 3.5 so added as runtime dependency in v2.0.10)
215216

216-
If you use a gem version of a core Ruby library it should work fine!
217+
If you use a gem version of a core Ruby library, it should work fine!
217218

218219
</details>
219220

@@ -413,11 +414,11 @@ gem install oauth2
413414
<details>
414415
<summary>For Medium or High Security Installations</summary>
415416

416-
This gem is cryptographically signed, and has verifiable [SHA-256 and SHA-512][💎SHA_checksums] checksums by
417+
This gem is cryptographically signed and has verifiable [SHA-256 and SHA-512][💎SHA_checksums] checksums by
417418
[stone_checksums][💎stone_checksums]. Be sure the gem you install hasn’t been tampered with
418419
by following the instructions below.
419420

420-
Add my public key (if you haven’t already, expires 2045-04-29) as a trusted certificate:
421+
Add my public key (if you haven’t already; will expire 2045-04-29) as a trusted certificate:
421422

422423
```console
423424
gem cert --add <(curl -Ls https://raw.github.com/galtzo-floss/certs/main/pboling.pem)
@@ -492,7 +493,7 @@ see [gemfiles/README.md](gemfiles/README.md), then submit a PR to the correct ma
492493
If something doesn't work on one of these interpreters, it's a bug.
493494

494495
This library may inadvertently work (or seem to work) on other Ruby
495-
implementations, however support will only be provided for the versions listed
496+
implementations; however, support will only be provided for the versions listed
496497
above.
497498

498499
If you would like this library to support another Ruby version, you may
@@ -531,13 +532,13 @@ Some OAuth 2.0 standards legitimately have multiple tokens.
531532
You may need to subclass `OAuth2::AccessToken`, or write your own custom alternative to it, and pass it in.
532533
Specify your custom class with the `access_token_class` option.
533534

534-
If you only need one token you can, as of v2.0.10,
535+
If you only need one token, you can, as of v2.0.10,
535536
specify the exact token name you want to extract via the `OAuth2::AccessToken` using
536537
the `token_name` option.
537538

538539
You'll likely need to do some source diving.
539540
This gem has 100% test coverage for lines and branches, so the specs are a great place to look for ideas.
540-
If you have time and energy please contribute to the documentation!
541+
If you have time and energy, please contribute to the documentation!
541542

542543
## 🔧 Basic Usage
543544

@@ -558,7 +559,7 @@ response.class.name
558559

559560
### Relative `authorize_url` and `token_url` (Not on site root, Just Works!)
560561

561-
In above example, the default Authorization URL is `oauth/authorize` and default Access Token URL is `oauth/token`, and, as they are missing a leading `/`, both are relative.
562+
In the above example, the default Authorization URL is `oauth/authorize` and default Access Token URL is `oauth/token`, and, as they are missing a leading `/`, both are relative.
562563

563564
```ruby
564565
client = OAuth2::Client.new("client_id", "client_secret", site: "https://example.org/nested/directory/on/your/server")
@@ -751,16 +752,18 @@ a hash of the values), or `from_kvform` (if you have an
751752
`application/x-www-form-urlencoded` encoded string of the values).
752753

753754
Options (since v2.0.x unless noted):
754-
- expires_latency (Integer | nil): Seconds to subtract from expires_in when computing #expired? to offset latency.
755-
- token_name (String | Symbol | nil): When multiple token-like fields exist in responses, select the field name to use as the access token (since v2.0.10).
756-
- mode (Symbol | Proc | Hash): Controls how the token is transmitted on requests made via this AccessToken instance.
757-
- :header — Send as Authorization: Bearer <token> header (default and preferred by OAuth 2.1 draft guidance).
758-
- :query — Send as access_token query parameter (discouraged in general, but required by some providers).
755+
- `expires_latency` (Integer | nil): Seconds to subtract from expires_in when computing #expired? to offset latency.
756+
- `token_name` (String | Symbol | nil): When multiple token-like fields exist in responses, select the field name to use as the access token (since v2.0.10).
757+
- `mode` (Symbol | Proc | Hash): Controls how the token is transmitted on requests made via this AccessToken instance.
758+
- `:header` — Send as Authorization: Bearer <token> header (default and preferred by OAuth 2.1 draft guidance).
759+
- `:query` — Send as access_token query parameter (discouraged in general, but required by some providers).
759760
- Verb-dependent (since v2.0.15): Provide either:
760-
- a Proc taking |verb| and returning :header or :query, or
761-
- a Hash with verb symbols as keys, for example: {get: :query, post: :header, delete: :header}.
761+
- a `Proc` taking `|verb|` and returning `:header` or `:query`, or
762+
- a `Hash` with verb symbols as keys, for example `{get: :query, post: :header, delete: :header}`.
762763

763-
Note: Verb-dependent mode was added in v2.0.15 to support providers like Instagram that require query mode for GET and header mode for POST/DELETE.
764+
Note: Verb-dependent mode supports providers like Instagram that require query mode for `GET` and header mode for `POST`/`DELETE`
765+
- Verb-dependent mode via `Proc` was added in v2.0.15
766+
- Verb-dependent mode via `Hash` was added in v2.0.16
764767

765768
### OAuth2::Error
766769

docs/OAuth2.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ <h3 class="signature first" id="configure-class_method">
415415
</div>
416416

417417
<div id="footer">
418-
Generated on Mon Sep 15 21:28:40 2025 by
418+
Generated on Tue Sep 16 00:53:52 2025 by
419419
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
420420
0.9.37 (ruby-3.4.5).
421421
</div>

docs/OAuth2/AccessToken.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3083,7 +3083,7 @@ <h3 class="signature " id="to_hash-instance_method">
30833083
</div>
30843084

30853085
<div id="footer">
3086-
Generated on Mon Sep 15 21:28:40 2025 by
3086+
Generated on Tue Sep 16 00:53:52 2025 by
30873087
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
30883088
0.9.37 (ruby-3.4.5).
30893089
</div>

docs/OAuth2/Authenticator.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ <h3 class="signature first" id="apply-instance_method">
883883
</div>
884884

885885
<div id="footer">
886-
Generated on Mon Sep 15 21:28:40 2025 by
886+
Generated on Tue Sep 16 00:53:52 2025 by
887887
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
888888
0.9.37 (ruby-3.4.5).
889889
</div>

docs/OAuth2/Client.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2656,7 +2656,7 @@ <h3 class="signature " id="token_url-instance_method">
26562656
</div>
26572657

26582658
<div id="footer">
2659-
Generated on Mon Sep 15 21:28:40 2025 by
2659+
Generated on Tue Sep 16 00:53:52 2025 by
26602660
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
26612661
0.9.37 (ruby-3.4.5).
26622662
</div>

docs/OAuth2/Error.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ <h3 class="signature " id="response-instance_method">
772772
</div>
773773

774774
<div id="footer">
775-
Generated on Mon Sep 15 21:28:40 2025 by
775+
Generated on Tue Sep 16 00:53:52 2025 by
776776
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
777777
0.9.37 (ruby-3.4.5).
778778
</div>

docs/OAuth2/FilteredAttributes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ <h3 class="signature first" id="inspect-instance_method">
335335
</div>
336336

337337
<div id="footer">
338-
Generated on Mon Sep 15 21:28:40 2025 by
338+
Generated on Tue Sep 16 00:53:52 2025 by
339339
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
340340
0.9.37 (ruby-3.4.5).
341341
</div>

docs/OAuth2/FilteredAttributes/ClassMethods.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ <h3 class="signature " id="filtered_attributes-instance_method">
280280
</div>
281281

282282
<div id="footer">
283-
Generated on Mon Sep 15 21:28:40 2025 by
283+
Generated on Tue Sep 16 00:53:52 2025 by
284284
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
285285
0.9.37 (ruby-3.4.5).
286286
</div>

docs/OAuth2/Response.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1619,7 +1619,7 @@ <h3 class="signature " id="status-instance_method">
16191619
</div>
16201620

16211621
<div id="footer">
1622-
Generated on Mon Sep 15 21:28:40 2025 by
1622+
Generated on Tue Sep 16 00:53:52 2025 by
16231623
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
16241624
0.9.37 (ruby-3.4.5).
16251625
</div>

0 commit comments

Comments
 (0)