Class AppleClientSecret
java.lang.Object
com.codename1.backend.security.oauth2.client.AppleClientSecret
- All Implemented Interfaces:
ClientRegistration.ClientSecretSupplier
public final class AppleClientSecret
extends Object
implements ClientRegistration.ClientSecretSupplier
The client secret of Sign in with Apple, which is not a text Apple issues
but a token this server signs: an ES256 JWT naming the team, the client and
Apple, signed with the .p8 key downloaded from the developer account.
CommonOAuth2Provider.APPLE.getBuilder("apple")
.clientId("com.example.web") // the Services ID
.clientSecretSupplier(AppleClientSecret.fromFile(teamId, keyId, "AuthKey.p8"))
.build();
A secret is good for an hour and is made again when it has under five minutes left, so signing costs one signature an hour and not one a sign-in.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AppleClientSecretAppleClientSecret(String, String, String)reading the key from a file.getClientSecret(ClientRegistration registration) The secret to send now.voidThe clock the secret's times are read from; for tests.
-
Field Details
-
AUDIENCE
-
-
Constructor Details
-
AppleClientSecret
- Parameters:
teamId- the ten-character Team ID of the developer accountkeyId- the Key ID of the Sign in with Apple keyprivateKeyPem- the text of the.p8file- Throws:
IOException
-
-
Method Details
-
fromFile
public static AppleClientSecret fromFile(String teamId, String keyId, String path) throws IOException AppleClientSecret(String, String, String)reading the key from a file.- Throws:
IOException
-
setClock
The clock the secret's times are read from; for tests. -
getClientSecret
Description copied from interface:ClientRegistration.ClientSecretSupplierThe secret to send now.- Specified by:
getClientSecretin interfaceClientRegistration.ClientSecretSupplier
-