Skip to content

Commit 9f65aa1

Browse files
acoburntimea-solid
andauthored
JCL-328: Deprecate UmaSession (#411)
Co-authored-by: Timea <4144203+timea-solid@users.noreply.github.com>
1 parent 52a7101 commit 9f65aa1

File tree

5 files changed

+15
-26
lines changed

5 files changed

+15
-26
lines changed

api/src/main/java/com/inrupt/client/auth/package-info.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
* for each implementation. Some examples:
3737
*
3838
* <pre>{@code
39-
Session session = OpenIdSession.ofIdToken(token);
40-
Session sessionWithConfig = OpenIdSession.ofIdToken(token, config);
41-
Session umaSession = UmaSession.of(session);
39+
Session openidSession = OpenIdSession.ofIdToken(token);
40+
Session openidSessionWithConfig = OpenIdSession.ofIdToken(token, config);
41+
Session accessGrantSession = AccessGrantSession.ofAccessGrant(openidSession, accessGrant);
4242
* }</pre>
4343
*
4444
* <h3>HTTP challenges</h3>

core/src/main/java/com/inrupt/client/core/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
.POST(Request.BodyPublishers.ofString("Test String 1"))
4545
.build();
4646
47-
Response<Void> response = client.session(UmaSession.of(s))
47+
Response<Void> response = client
4848
.send(request, Response.BodyHandlers.discarding())
4949
.toCompletableFuture().join();
5050
* }</pre>

core/src/test/java/com/inrupt/client/core/DefaultClientTest.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import com.inrupt.client.jena.JenaBodyPublishers;
3737
import com.inrupt.client.openid.OpenIdConfig;
3838
import com.inrupt.client.openid.OpenIdSession;
39-
import com.inrupt.client.uma.UmaSession;
4039

4140
import java.io.IOException;
4241
import java.io.InputStream;
@@ -206,10 +205,10 @@ void testOfModelPublisherBearer() throws IOException, InterruptedException {
206205
claims.put("azp", AZP);
207206
claims.put("cnf", Collections.singletonMap("jkt", ecJwk.calculateBase64urlEncodedThumbprint(SHA_256)));
208207
final String token = generateIdToken(claims);
209-
final Session session = UmaSession.of(OpenIdSession.ofIdToken(token, config));
208+
final Session session = OpenIdSession.ofIdToken(token, config);
210209
assertEquals(Optional.of(URI.create(WEBID)), session.getPrincipal());
211210

212-
final Session session2 = UmaSession.of();
211+
final Session session2 = Session.anonymous();
213212
assertFalse(session2.getPrincipal().isPresent());
214213
assertNotEquals(session2.getId(), session.getId());
215214
assertFalse(session2.generateProof(null, null).isPresent());
@@ -327,7 +326,7 @@ void testPutRDF() throws Exception {
327326
}
328327

329328
@Test
330-
void testOfStringPublisherUmaSession() throws IOException, InterruptedException {
329+
void testOfStringPublisherOpenidSession() throws IOException, InterruptedException {
331330
final Map<String, Object> claims = new HashMap<>();
332331
claims.put("webid", WEBID);
333332
claims.put("sub", SUB);
@@ -346,7 +345,7 @@ void testOfStringPublisherUmaSession() throws IOException, InterruptedException
346345
config.setProofKeyPairs(Collections.singletonMap("RS256",
347346
new KeyPair(jwk.getPublicKey(), jwk.getPrivateKey())));
348347

349-
final Response<Void> response = client.session(UmaSession.of(OpenIdSession.ofIdToken(token, config)))
348+
final Response<Void> response = client.session(OpenIdSession.ofIdToken(token, config))
350349
.send(request, Response.BodyHandlers.discarding())
351350
.toCompletableFuture().join();
352351

@@ -361,7 +360,7 @@ void testOfStringPublisherUmaAnonSession() throws IOException, InterruptedExcept
361360
.POST(Request.BodyPublishers.ofString("Test String 1"))
362361
.build();
363362

364-
final Response<Void> response = client.session(UmaSession.of())
363+
final Response<Void> response = client.session(Session.anonymous())
365364
.send(request, Response.BodyHandlers.discarding())
366365
.toCompletableFuture().join();
367366

@@ -375,7 +374,7 @@ void testNullSession() {
375374
}
376375

377376
@Test
378-
void testUmaSessionExpiredIdToken() throws Exception {
377+
void testSessionExpiredIdToken() throws Exception {
379378
final Map<String, Object> claims = new HashMap<>();
380379
claims.put("webid", WEBID);
381380
claims.put("sub", SUB);
@@ -398,7 +397,7 @@ void testUmaSessionExpiredIdToken() throws Exception {
398397
.POST(Request.BodyPublishers.ofString("Test String 1"))
399398
.build();
400399

401-
final Response<Void> response = client.session(UmaSession.of(s))
400+
final Response<Void> response = client.session(s)
402401
.send(request, Response.BodyHandlers.discarding())
403402
.toCompletableFuture().join();
404403

uma/src/main/java/com/inrupt/client/uma/UmaSession.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@
3838

3939
/**
4040
* A session implementation for use with UMA Authorization Servers.
41+
*
42+
* @deprecated As of Beta3, this class is deprecated
4143
*/
44+
@Deprecated
4245
public final class UmaSession implements Session {
4346

4447
private final String id;

uma/src/main/java/com/inrupt/client/uma/package-info.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,10 @@
2323
*
2424
* <p>UMA builds on the OAuth 2.0 authorization framework, defining a mechanism by which
2525
* a client can iteratively negotiate for an access token.
26-
*
26+
*
2727
* <p>{@code UmaClient} helps in the interaction with different endpoints, to construct helper
2828
* requests for authentication and to negotiate for a token.
29-
*
30-
* <h3>Using a UMA session</h3>
31-
*
32-
* <p>This module has a session implementation, {@code UmaSession}, for use with UMA Authorization Servers.
3329
*
34-
* <p>This session implementation can be used to wrap other session objects, such as
35-
* ones that use OpenID Connect tokens.
36-
*
37-
* <pre>{@code
38-
* Client client = ClientProvider.getClient();
39-
* Session session = client.session(UmaSession.ofSession(OpenIdSession.ofIdToken(jwt)));
40-
* Response res = session.send(req, bodyHandler);
41-
* }</pre>
42-
*
4330
* <h3>Discovering the UMA configuration</h3>
4431
*
4532
* <pre>{@code

0 commit comments

Comments
 (0)