Skip to content

Commit ec28244

Browse files
authored
feat: add MIGRATION_GUIDE (#900)
1 parent 5d18b5f commit ec28244

5 files changed

Lines changed: 170 additions & 4 deletions

File tree

.fernignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ README.md
66
# Examples and Migration Guide from auth0-real
77
EXAMPLES.md
88
v3_MIGRATION_GUIDE.md
9-
MIGRATION_GUIDE.md
9+
v4_MIGRATION_GUIDE.md
1010
LICENSE
1111
CHANGELOG.md
1212

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ ManagementApi client = ManagementApi
143143
```
144144

145145
**Note**: The Authentication API remains supported, with deprecated APIs removed.
146-
A complete migration guide is available at [MIGRATION_GUIDE](MIGRATION_GUIDE.md).
146+
A complete migration guide is available at [MIGRATION_GUIDE](v3_MIGRATION_GUIDE).
147147

148148
## [3.0.0-beta.0](https://github.com/auth0/auth0-java/tree/3.0.0-beta.0) (2025-12-18)
149149
[Full Changelog](https://github.com/auth0/auth0-java/compare/2.27.0...3.0.0-beta.0)
@@ -157,7 +157,7 @@ A complete migration guide is available at [MIGRATION_GUIDE](MIGRATION_GUIDE.md)
157157
- Nullability annotations to POJO classes
158158
- Fully compatible **Authentication API client** — no breaking changes
159159

160-
- [Migration guide](MIGRATION_GUIDE) available for upgrading from v2.x
160+
- [Migration guide](v3_MIGRATION_GUIDE) available for upgrading from v2.x
161161

162162

163163
## [2.27.0](https://github.com/auth0/auth0-java/tree/2.27.0) (2025-12-18)

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
## Documentation
2121
- [Reference](./reference.md) - code samples for Management APIs.
2222
- [Examples](./EXAMPLES.md) - code samples for common auth0-java scenarios.
23-
- [Migration Guide](./MIGRATION_GUIDE.md) - guidance for updating your application to use version 3 of auth0-java.
23+
- [v4 Migration Guide](./v4_MIGRATION_GUIDE.md) - guidance for updating your application from version 3 to version 4 of auth0-java.
24+
- [v3 Migration Guide](./v3_MIGRATION_GUIDE.md) - guidance for updating your application from version 2 to version 3 of auth0-java.
2425
- [Docs site](https://www.auth0.com/docs) - explore our docs site and learn more about Auth0.
2526

2627
## Getting Started
File renamed without changes.

v4_MIGRATION_GUIDE.md

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# Migrating from v3 to v4
2+
3+
`v4` is a compatible evolution of `v3`. The Authentication API is unchanged, and the Management API keeps the same client structure, builder patterns, and pagination introduced in `v3`. The breaking changes are narrow: a few generated Management API types where field types were tightened or split for type-safety, and the removal of the Federated Connections Tokensets API.
4+
5+
- [Overview](#overview)
6+
- [Breaking changes](#breaking-changes)
7+
- [1. Role pagination fields are now non-optional primitives](#1-role-pagination-fields-are-now-non-optional-primitives)
8+
- [2. Connection attribute `identifier` is split by attribute type](#2-connection-attribute-identifier-is-split-by-attribute-type)
9+
- [3. Phone provider protection backoff strategy enum value changed](#3-phone-provider-protection-backoff-strategy-enum-value-changed)
10+
- [4. Federated Connections Tokensets API removed](#4-federated-connections-tokensets-api-removed)
11+
- [Other changes](#other-changes)
12+
- [Per-request retry configuration](#per-request-retry-configuration)
13+
- [Query parameter serialization](#query-parameter-serialization)
14+
- [Migration steps](#migration-steps)
15+
16+
## Overview
17+
18+
Most `v3` code compiles and runs unchanged on `v4`. You only need to act if your code touches one of the following:
19+
20+
| Area | What changed | Impact |
21+
|------|--------------|--------|
22+
| `ListRolesOffsetPaginatedResponseContent` | `start` / `limit` / `total` changed from `Optional<Double>` to primitive `double`, and are now required builder stages | Callers reading these getters or constructing the type |
23+
| Connection attributes | The shared `ConnectionAttributeIdentifier` type is removed and replaced by dedicated `EmailAttributeIdentifier`, `PhoneAttributeIdentifier`, and `UsernameAttributeIdentifier` types | Callers reading/setting `identifier` on `EmailAttribute`, `PhoneAttribute`, `UsernameAttribute` |
24+
| `PhoneProviderProtectionBackoffStrategyEnum` | `NONE` (`"none"`) removed, replaced by `DEFAULT` (`"default"`) | Callers referencing the `NONE` constant or visitor |
25+
| Federated Connections Tokensets | `client.users().federatedConnectionsTokensets()` and its types removed | Callers of that API |
26+
27+
Everything else in `v4` is additive or internal.
28+
29+
## Breaking changes
30+
31+
### 1. Role pagination fields are now non-optional primitives
32+
33+
In `ListRolesOffsetPaginatedResponseContent`, the `start`, `limit`, and `total` fields change from `Optional<Double>` to primitive `double`, and the builder now requires them as mandatory, staged arguments.
34+
35+
**v3:**
36+
```java
37+
private final Optional<Double> start;
38+
public Optional<Double> getStart() { ... }
39+
```
40+
41+
**v4:**
42+
```java
43+
private final double start;
44+
public double getStart() { ... }
45+
```
46+
47+
If you read these getters, drop the `Optional` handling:
48+
49+
```java
50+
// v3
51+
double start = response.getStart().orElse(0d);
52+
53+
// v4
54+
double start = response.getStart();
55+
```
56+
57+
If you construct the type, the builder is now staged and requires `start`, `limit`, and `total` in order:
58+
59+
```java
60+
// v4
61+
ListRolesOffsetPaginatedResponseContent content = ListRolesOffsetPaginatedResponseContent.builder()
62+
.start(0)
63+
.limit(50)
64+
.total(200)
65+
.roles(roles)
66+
.build();
67+
```
68+
69+
### 2. Connection attribute `identifier` is split by attribute type
70+
71+
The shared `ConnectionAttributeIdentifier` type is removed and replaced with dedicated types per attribute. The `identifier` field on `EmailAttribute`, `PhoneAttribute`, and `UsernameAttribute` now uses the matching type, so their `getIdentifier()` and builder `identifier(...)` signatures change.
72+
73+
| Attribute | v3 identifier type | v4 identifier type |
74+
|-----------|--------------------|--------------------|
75+
| `EmailAttribute` | `ConnectionAttributeIdentifier` | `EmailAttributeIdentifier` |
76+
| `PhoneAttribute` | `ConnectionAttributeIdentifier` | `PhoneAttributeIdentifier` |
77+
| `UsernameAttribute` | `ConnectionAttributeIdentifier` | `UsernameAttributeIdentifier` |
78+
79+
**v3:**
80+
```java
81+
public Optional<ConnectionAttributeIdentifier> getIdentifier() { ... }
82+
```
83+
84+
**v4 (`EmailAttribute`):**
85+
```java
86+
public Optional<EmailAttributeIdentifier> getIdentifier() { ... }
87+
```
88+
89+
Update your imports and any variables holding the identifier. The new types expose `active` (`Optional<Boolean>`); `EmailAttributeIdentifier` and `PhoneAttributeIdentifier` additionally expose a `defaultMethod` (`DefaultMethodEmailIdentifierEnum` / `DefaultMethodPhoneNumberIdentifierEnum`).
90+
91+
```java
92+
// v4
93+
EmailAttribute email = EmailAttribute.builder()
94+
.identifier(EmailAttributeIdentifier.builder()
95+
.active(true)
96+
.build())
97+
.build();
98+
```
99+
100+
### 3. Phone provider protection backoff strategy enum value changed
101+
102+
`PhoneProviderProtectionBackoffStrategyEnum.NONE` (`"none"`, `visitNone()`) is removed and replaced by `PhoneProviderProtectionBackoffStrategyEnum.DEFAULT` (`"default"`, `visitDefault()`).
103+
104+
**v3:**
105+
```java
106+
PhoneProviderProtectionBackoffStrategyEnum strategy = PhoneProviderProtectionBackoffStrategyEnum.NONE;
107+
```
108+
109+
**v4:**
110+
```java
111+
PhoneProviderProtectionBackoffStrategyEnum strategy = PhoneProviderProtectionBackoffStrategyEnum.DEFAULT;
112+
```
113+
114+
If you implement the visitor interface, rename `visitNone()` to `visitDefault()`.
115+
116+
### 4. Federated Connections Tokensets API removed
117+
118+
The Federated Connections Tokensets API is removed. The following are no longer available:
119+
120+
- Client accessor: `client.users().federatedConnectionsTokensets()` (and its async/raw variants)
121+
- Types: `FederatedConnectionTokenSet`, `ConnectionFederatedConnectionsAccessTokens`
122+
123+
**v3:**
124+
```java
125+
List<FederatedConnectionTokenSet> tokensets =
126+
client.users().federatedConnectionsTokensets().list("user_id");
127+
128+
client.users().federatedConnectionsTokensets().delete("user_id", "tokenset_id");
129+
```
130+
131+
**v4:**
132+
133+
No replacement is generated in the SDK. Remove these calls; if you still need this functionality, call the corresponding Management API endpoint directly.
134+
135+
## Other changes
136+
137+
These are backward-compatible but worth noting.
138+
139+
### Per-request retry configuration
140+
141+
Requests now honor a per-request `maxRetries` value via `RequestOptions`, alongside the existing `timeout`:
142+
143+
```java
144+
GetUserResponseContent user = client.users().get(
145+
"user_id",
146+
GetUserRequestParameters.builder().build(),
147+
RequestOptions.builder()
148+
.timeout(10)
149+
.maxRetries(2)
150+
.build()
151+
);
152+
```
153+
154+
### Query parameter serialization
155+
156+
List/query parameter types (e.g. `ListUsersRequestParameters`, `ListClientsRequestParameters`, `ListLogsRequestParameters`, `ListConnectionsQueryParameters`) now serialize their optional/nullable query parameters through a nullable-nonempty filter instead of being marked `@JsonIgnore`. Builder usage is unchanged; this only affects how parameters are emitted on the wire.
157+
158+
## Migration steps
159+
160+
1. Update the dependency to the `v4` release.
161+
2. Replace any `ConnectionAttributeIdentifier` imports/usages with the matching `EmailAttributeIdentifier`, `PhoneAttributeIdentifier`, or `UsernameAttributeIdentifier`.
162+
3. Remove `Optional` handling around `ListRolesOffsetPaginatedResponseContent#getStart/getLimit/getTotal`, and update any builder usage to the staged `start``limit``total` form.
163+
4. Replace `PhoneProviderProtectionBackoffStrategyEnum.NONE` with `DEFAULT` (and `visitNone()` with `visitDefault()` in any visitor implementations).
164+
5. Remove any usage of `client.users().federatedConnectionsTokensets()` and the `FederatedConnectionTokenSet` / `ConnectionFederatedConnectionsAccessTokens` types.
165+
6. Run `mvn verify` (or your build) and fix any remaining compilation errors surfaced by the above.

0 commit comments

Comments
 (0)