Skip to content

Commit aa8bf1a

Browse files
committed
add missing javadocs and kdocs
1 parent 26de3f1 commit aa8bf1a

File tree

3 files changed

+99
-2
lines changed

3 files changed

+99
-2
lines changed

aws-auth-cognito/src/main/java/com/amplifyframework/auth/cognito/options/AWSCognitoAuthWebUISignInOptions.java

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,22 @@ public final class AWSCognitoAuthWebUISignInOptions extends AuthWebUISignInOptio
3636
private final String loginHint;
3737
private final List<AuthWebUIPrompt> prompt;
3838
private final String resource;
39+
3940
/**
4041
* Advanced options for signing in via a hosted web ui.
4142
* @param scopes specify OAUTH scopes
4243
* @param idpIdentifier The IdentityProvider identifier if using multiple instances of same identity provider.
4344
* @param browserPackage Specify which browser package should be used for web sign in (e.g. "org.mozilla.firefox").
4445
* Defaults to the Chrome package if not specified.
4546
* @param preferPrivateSession specifying whether or not to launch web ui in an ephemeral CustomTab.
47+
* @param nonce random value that can be added to the request, which is included in the ID token
48+
* that Amazon Cognito issues.
49+
* @param language language displayed in user-interactive page
50+
* @param loginHint username prompt passed to the authorization server
51+
* @param prompt a list of OIDC parameters that controls authentication behavior for existing sessions.
52+
* @param resource identifier of a resource that you want to bind to the access token in the `aud` claim.
4653
*/
54+
@SuppressWarnings("checkstyle:all")
4755
protected AWSCognitoAuthWebUISignInOptions(
4856
List<String> scopes,
4957
String idpIdentifier,
@@ -83,26 +91,53 @@ public String getBrowserPackage() {
8391
return browserPackage;
8492
}
8593

94+
/**
95+
* Optional A random value that can be added to the request, which is included in the ID token
96+
* that Amazon Cognito issues. To guard against replay attacks, your app can inspect the nonce claim in the ID
97+
* token and compare it to the one you generated.
98+
* @return the nonce value
99+
*/
86100
@Nullable
87101
public String getNonce() {
88102
return nonce;
89103
}
90104

105+
/** Optional The language displayed in user-interactive page.
106+
* For more information, see Managed login localization
107+
* https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-managed-login.html
108+
* @return the language value
109+
*/
91110
@Nullable
92111
public String getLanguage() {
93112
return language;
94113
}
95114

115+
/** Optional A username prompt passed to the authorization server. You can collect a username, email
116+
* address or phone number from your user and allow the destination provider to pre-populate the user's
117+
* sign-in name.
118+
* @return the login prompt displayed in the username field
119+
*/
96120
@Nullable
97121
public String getLoginHint() {
98122
return loginHint;
99123
}
100124

125+
/**
126+
* Optional An OIDC parameter that controls authentication behavior for existing sessions.
127+
* @return the prompt value
128+
*/
101129
@Nullable
102130
public List<AuthWebUIPrompt> getPrompt() {
103131
return prompt;
104132
}
105133

134+
/**
135+
* Optional The identifier of a resource that you want to bind to the access token in the `aud`
136+
* claim. When this parameter is included, Amazon Cognito validates that the value is a URL and
137+
* sets the audience of the resulting access token to the requested resource. Values for this
138+
* parameter must begin with "https://", "http://localhost" or a custom URL scheme like "myapp://".
139+
* @return the resource value
140+
*/
106141
@Nullable
107142
public String getResource() {
108143
return resource;
@@ -158,7 +193,7 @@ public String toString() {
158193
"scopes=" + getScopes() +
159194
", idpIdentifier=" + getIdpIdentifier() +
160195
", browserPackage=" + getBrowserPackage() +
161-
", preferPrivateSession=" + getPreferPrivateSession() +
196+
", preferPrivateSession=" + getPreferPrivateSession() +
162197
", nonce=" + getNonce() +
163198
", language=" + getLanguage() +
164199
", loginHint=" + getLoginHint() +
@@ -206,33 +241,64 @@ public CognitoBuilder idpIdentifier(@NonNull String idpIdentifier) {
206241
return getThis();
207242
}
208243

244+
/**
245+
* A random value that can be added to the request, which is included in the ID token
246+
* that Amazon Cognito issues.
247+
* @param nonce a random value to be added to the request
248+
* @return the instance of the builder.
249+
*/
209250
@NonNull
210251
public CognitoBuilder nonce(@NonNull String nonce) {
211252
this.nonce = nonce;
212253
return getThis();
213254
}
214255

256+
/** The language displayed in user-interactive page.
257+
* For more information, see Managed login localization
258+
* https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-managed-login.html
259+
* @param language language value
260+
* @return the instance of the builder.
261+
*/
215262
@NonNull
216263
public CognitoBuilder language(@NonNull String language) {
217264
this.language = language;
218265
return getThis();
219266
}
220267

268+
/** A username prompt passed to the authorization server. You can collect a username, email
269+
* address or phone number from your user and allow the destination provider to pre-populate the user's
270+
* sign-in name.
271+
* @param loginHint login prompt to pass to authorization server
272+
* @return the instance of the builder.
273+
*/
221274
@NonNull
222275
public CognitoBuilder loginHint(@NonNull String loginHint) {
223276
this.loginHint = loginHint;
224277
return getThis();
225278
}
226279

280+
/**
281+
* Optional An OIDC parameter that controls authentication behavior for existing sessions.
282+
* @param prompt list of AuthWebUIPrompt values
283+
* @return the instance of the builder.
284+
*/
227285
@NonNull
228286
public CognitoBuilder prompt(AuthWebUIPrompt... prompt) {
229287
this.prompt = new ArrayList<>();
230-
for (AuthWebUIPrompt value: prompt) {
288+
for (AuthWebUIPrompt value : prompt) {
231289
this.prompt.add(value);
232290
}
233291
return getThis();
234292
}
235293

294+
/**
295+
* Optional The identifier of a resource that you want to bind to the access token in the `aud`
296+
* claim. When this parameter is included, Amazon Cognito validates that the value is a URL and
297+
* sets the audience of the resulting access token to the requested resource. Values for this
298+
* parameter must begin with "https://", "http://localhost" or a custom URL scheme like "myapp://".
299+
* @param resource resource value
300+
* @return the instance of the builder.
301+
*/
236302
@NonNull
237303
public CognitoBuilder resource(@NonNull String resource) {
238304
this.resource = resource;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,39 @@
11
package com.amplifyframework.auth.cognito.options
22

3+
/**
4+
* An OIDC parameter that controls authentication behavior for existing sessions.
5+
*/
36
public enum class AuthWebUIPrompt(val value: String) {
7+
/**
8+
* Amazon Cognito silently continues authentication for users who have a valid authenticated session.
9+
* With this prompt, users can silently authenticate between different app clients in your user pool.
10+
* If the user is not already authenticated, the authorization server returns a login_required error.
11+
*/
412
NONE(value = "none"),
513

14+
/**
15+
* Amazon Cognito requires users to re-authenticate even if they have an existing session. Send this
16+
* value when you want to verify the user's identity again. Authenticated users who have an existing
17+
* session can return to sign-in without invalidating that session. When a user who has an existing
18+
* session signs in again, Amazon Cognito assigns them a new session cookie. This parameter can also
19+
* be forwarded to your IdPs. IdPs that accept this parameter also request a new authentication
20+
* attempt from the user.
21+
*/
622
LOGIN(value = "login"),
723

24+
/**
25+
* This value has no effect on local sign-in and must be submitted in requests that redirect to IdPs.
26+
* When included in your authorization request, this parameter adds prompt=select_account to the URL
27+
* path for the IdP redirect destination. When IdPs support this parameter, they request that users
28+
* select the account that they want to log in with.
29+
*/
830
SELECT_ACCOUNT(value = "select_account"),
931

32+
/**
33+
* This value has no effect on local sign-in and must be submitted in requests that redirect to IdPs.
34+
* When included in your authorization request, this parameter adds prompt=consent to the URL path for
35+
* the IdP redirect destination. When IdPs support this parameter, they request user consent before
36+
* they redirect back to your user pool.
37+
*/
1038
CONSENT(value = "consent")
1139
}

aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/options/APIOptionsContractTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ public void testCognitoOptions() {
128128
.getDeveloperProvidedIdentityId());
129129
}
130130

131+
/**
132+
* Test Java CognitoAuthWebUIOptions OIDC parameters builder methods.
133+
*/
131134
@Test
132135
public void testCognitoAuthWebUISignInOIDCParameters() {
133136
List<AuthWebUIPrompt> prompt = Arrays.asList(AuthWebUIPrompt.LOGIN, AuthWebUIPrompt.CONSENT);

0 commit comments

Comments
 (0)