aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/github/scribejava
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/github/scribejava')
-rw-r--r--src/main/java/com/github/scribejava/apis/AppleClientAuthentication.java2
-rw-r--r--src/main/java/com/github/scribejava/apis/AppleClientSecretGenerator.java37
2 files changed, 4 insertions, 35 deletions
diff --git a/src/main/java/com/github/scribejava/apis/AppleClientAuthentication.java b/src/main/java/com/github/scribejava/apis/AppleClientAuthentication.java
index b4198af16..919cbafe5 100644
--- a/src/main/java/com/github/scribejava/apis/AppleClientAuthentication.java
+++ b/src/main/java/com/github/scribejava/apis/AppleClientAuthentication.java
@@ -27,7 +27,7 @@ public class AppleClientAuthentication implements ClientAuthentication {
}
@Override
public void addClientAuthentication(OAuthRequest request, String apiKey, String apiSecret) {
- request.addBodyParameter("client_id", generator.getApplicationId());
+ request.addBodyParameter("client_id", generator.subject());
request.addBodyParameter("client_secret", generator.getClientSecret());
}
}
diff --git a/src/main/java/com/github/scribejava/apis/AppleClientSecretGenerator.java b/src/main/java/com/github/scribejava/apis/AppleClientSecretGenerator.java
index c6bbf63d5..212545508 100644
--- a/src/main/java/com/github/scribejava/apis/AppleClientSecretGenerator.java
+++ b/src/main/java/com/github/scribejava/apis/AppleClientSecretGenerator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2020, Juick
+ * Copyright (C) 2008-2022, Juick
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -19,33 +19,14 @@ package com.github.scribejava.apis;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
+import org.tomitribe.churchkey.Key;
-import java.security.NoSuchAlgorithmException;
-import java.security.spec.InvalidKeySpecException;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;
-import org.tomitribe.churchkey.Key;
-import org.tomitribe.churchkey.Keys;
-
-public class AppleClientSecretGenerator {
- private final String subject;
- private final String teamId;
- private final String keyId;
-
- private final Key signingKey;
-
- public AppleClientSecretGenerator(final String subject, final String teamId, final String keyId, final byte[] pemData)
- throws NoSuchAlgorithmException, InvalidKeySpecException {
- this.subject = subject;
- this.keyId = keyId;
- this.teamId = teamId;
-
- this.signingKey = Keys.decode(pemData);
- }
-
+public record AppleClientSecretGenerator(String subject, String teamId, String keyId, Key signingKey) {
public String getClientSecret() {
Instant now = Instant.now();
return Jwts.builder()
@@ -59,18 +40,6 @@ public class AppleClientSecretGenerator {
.compact();
}
- public String getTeamId() {
- return teamId;
- }
-
- public String getKeyId() {
- return keyId;
- }
-
- public String getApplicationId() {
- return subject;
- }
-
public java.security.Key getPublicKey() {
return signingKey.getPublicKey().getKey();
}