Skip to content

Commit 0ff475b

Browse files
author
sgonzalezMSFT
committed
Update JavaDoc
1 parent cf1f07d commit 0ff475b

31 files changed

+261
-120
lines changed

src/main/java/com/microsoft/aad/msal4j/Account.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
import lombok.Setter;
2929
import lombok.experimental.Accessors;
3030

31+
/**
32+
* Representation of a single user account. If modifying this object, ensure it is compliant with
33+
* cache persistent model
34+
*/
3135
@Accessors(fluent = true)
3236
@Getter
3337
@Setter

src/main/java/com/microsoft/aad/msal4j/AppMetadataCacheEntity.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@
3131
import java.util.ArrayList;
3232
import java.util.List;
3333

34+
/**
35+
* Representation of application metadata.
36+
*/
3437
@Accessors(fluent = true)
3538
@Getter
3639
@Setter
37-
public class AppMetadataCacheEntity {
40+
class AppMetadataCacheEntity {
3841

3942
public static final String APP_METADATA_CACHE_ENTITY_ID = "appmetadata";
4043

src/main/java/com/microsoft/aad/msal4j/AuthorizationCodeParameters.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131

3232
import static com.microsoft.aad.msal4j.ParameterValidationUtils.validateNotBlank;
3333

34+
/**
35+
* Object containing parameters for authorization code flow. Can be used as parameter to
36+
* {@link PublicClientApplication#acquireToken(AuthorizationCodeParameters)} or to
37+
* {@link ConfidentialClientApplication#acquireToken(AuthorizationCodeParameters)}
38+
*/
3439
@Builder
3540
@Accessors(fluent = true)
3641
@Getter
@@ -50,6 +55,12 @@ private static AuthorizationCodeParametersBuilder builder() {
5055
return new AuthorizationCodeParametersBuilder();
5156
}
5257

58+
/**
59+
* Builder for {@link AuthorizationCodeParameters}
60+
* @param authorizationCode code received from the service authorization endpoint
61+
* @param redirectUri URI where authorization code was received
62+
* @return builder object that can be used to construct {@link AuthorizationCodeParameters}
63+
*/
5364
public static AuthorizationCodeParametersBuilder builder(String authorizationCode, URI redirectUri) {
5465

5566
validateNotBlank("authorizationCode", authorizationCode);

src/main/java/com/microsoft/aad/msal4j/ClientApplicationBase.java

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,44 @@ CompletableFuture<IAuthenticationResult> executeRequest(
129129
return future;
130130
}
131131

132+
@Override
133+
public CompletableFuture<IAuthenticationResult> acquireTokenSilently(SilentParameters parameters)
134+
throws MalformedURLException {
135+
136+
validateNotNull("parameters", parameters);
137+
138+
SilentRequest silentRequest = new SilentRequest(
139+
parameters,
140+
this,
141+
createRequestContext(PublicApi.ACQUIRE_TOKEN_SILENTLY));
142+
143+
return executeRequest(silentRequest);
144+
}
145+
146+
@Override
147+
public CompletableFuture<Set<IAccount>> getAccounts() {
148+
MsalRequest msalRequest =
149+
new MsalRequest(this, null,
150+
createRequestContext(PublicApi.GET_ACCOUNTS)){};
151+
152+
AccountsSupplier supplier = new AccountsSupplier(this, msalRequest);
153+
154+
CompletableFuture<Set<IAccount>> future =
155+
serviceBundle.getExecutorService() != null ? CompletableFuture.supplyAsync(supplier, serviceBundle.getExecutorService())
156+
: CompletableFuture.supplyAsync(supplier);
157+
return future;
158+
}
159+
160+
@Override
161+
public CompletableFuture removeAccount(IAccount account) {
162+
RemoveAccountRunnable runnable = new RemoveAccountRunnable(this, account);
163+
164+
CompletableFuture<Void> future =
165+
serviceBundle.getExecutorService() != null ? CompletableFuture.runAsync(runnable, serviceBundle.getExecutorService())
166+
: CompletableFuture.runAsync(runnable);
167+
return future;
168+
}
169+
132170
AuthenticationResult acquireTokenCommon(MsalRequest msalRequest, Authority requestAuthority)
133171
throws Exception {
134172

@@ -186,44 +224,6 @@ ServiceBundle getServiceBundle() {
186224
return serviceBundle;
187225
}
188226

189-
@Override
190-
public CompletableFuture<IAuthenticationResult> acquireTokenSilently(SilentParameters parameters)
191-
throws MalformedURLException {
192-
193-
validateNotNull("parameters", parameters);
194-
195-
SilentRequest silentRequest = new SilentRequest(
196-
parameters,
197-
this,
198-
createRequestContext(PublicApi.ACQUIRE_TOKEN_SILENTLY));
199-
200-
return executeRequest(silentRequest);
201-
}
202-
203-
@Override
204-
public CompletableFuture<Set<IAccount>> getAccounts() {
205-
MsalRequest msalRequest =
206-
new MsalRequest(this, null,
207-
createRequestContext(PublicApi.GET_ACCOUNTS)){};
208-
209-
AccountsSupplier supplier = new AccountsSupplier(this, msalRequest);
210-
211-
CompletableFuture<Set<IAccount>> future =
212-
serviceBundle.getExecutorService() != null ? CompletableFuture.supplyAsync(supplier, serviceBundle.getExecutorService())
213-
: CompletableFuture.supplyAsync(supplier);
214-
return future;
215-
}
216-
217-
@Override
218-
public CompletableFuture removeAccount(IAccount account) {
219-
RemoveAccountRunnable runnable = new RemoveAccountRunnable(this, account);
220-
221-
CompletableFuture<Void> future =
222-
serviceBundle.getExecutorService() != null ? CompletableFuture.runAsync(runnable, serviceBundle.getExecutorService())
223-
: CompletableFuture.runAsync(runnable);
224-
return future;
225-
}
226-
227227
protected static String canonicalizeUrl(String authority) {
228228
authority = authority.toLowerCase();
229229

@@ -272,7 +272,6 @@ public Builder(String clientId) {
272272
* @return instance of the Builder on which method was called
273273
* @throws MalformedURLException if val is malformed URL
274274
*/
275-
276275
public T authority(String val) throws MalformedURLException {
277276
authority = canonicalizeUrl(val);
278277

src/main/java/com/microsoft/aad/msal4j/ClientAssertion.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import lombok.Getter;
2929
import lombok.experimental.Accessors;
3030

31-
/***
31+
/**
3232
* Credential type containing an assertion of type
3333
* "urn:ietf:params:oauth:token-type:jwt".
3434
*/
@@ -44,8 +44,7 @@ public final class ClientAssertion {
4444
* Constructor to create credential with a jwt token encoded as a base64 url
4545
* encoded string.
4646
*
47-
* @param assertion
48-
* The jwt used as credential.
47+
* @param assertion The jwt used as credential.
4948
*/
5049
public ClientAssertion(final String assertion) {
5150
if (StringHelper.isBlank(assertion)) {

src/main/java/com/microsoft/aad/msal4j/ClientCredentialFactory.java

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,47 @@
2929
import java.security.cert.CertificateException;
3030
import java.security.cert.X509Certificate;
3131

32+
/**
33+
* Factory for creating client credentials used in confidential client flows
34+
*/
3235
public class ClientCredentialFactory {
3336

37+
/**
38+
*
39+
* @param secret secret of application requesting a token
40+
* @return {@link ClientSecret}
41+
*/
3442
public static IClientCredential create(String secret){
3543
return new ClientSecret(secret);
3644
}
3745

46+
/**
47+
*
48+
* @param pkcs12Certificate InputStream containing PCKS12 formatted certificate
49+
* @param password certificate password
50+
* @return {@link IClientCredential}
51+
* @throws CertificateException
52+
* @throws UnrecoverableKeyException
53+
* @throws NoSuchAlgorithmException
54+
* @throws KeyStoreException
55+
* @throws NoSuchProviderException
56+
* @throws IOException
57+
*/
3858
public static IClientCredential create
3959
(final InputStream pkcs12Certificate, final String password)
4060
throws CertificateException, UnrecoverableKeyException, NoSuchAlgorithmException,
4161
KeyStoreException, NoSuchProviderException, IOException {
4262
return AsymmetricKeyCredential.create(pkcs12Certificate, password);
4363
}
4464

65+
/**
66+
*
67+
* @param key RSA private key to sign the assertion.
68+
* @param publicCertificate x509 public certificate used for thumbprint
69+
* @return {@link IClientCredential}
70+
*/
4571
public static IClientCredential create
46-
(final PrivateKey key, final X509Certificate publicCertificate)
47-
{
72+
(final PrivateKey key, final X509Certificate publicCertificate) {
4873
return AsymmetricKeyCredential.create(key, publicCertificate);
4974
}
5075
}

src/main/java/com/microsoft/aad/msal4j/ClientCredentialParameters.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030

3131
import static com.microsoft.aad.msal4j.ParameterValidationUtils.validateNotEmpty;
3232

33+
/**
34+
* Object containing parameters for client credential flow. Can be used as parameter to
35+
* {@link ConfidentialClientApplication#acquireToken(ClientCredentialParameters)}
36+
*/
3337
@Builder
3438
@Accessors(fluent = true)
3539
@Getter
@@ -44,6 +48,11 @@ private static ClientCredentialParametersBuilder builder() {
4448
return new ClientCredentialParametersBuilder();
4549
}
4650

51+
/**
52+
* Builder for {@link ClientCredentialParameters}
53+
* @param scopes scopes application is requesting access to
54+
* @return builder that can be used to construct ClientCredentialParameters
55+
*/
4756
public static ClientCredentialParametersBuilder builder(Set<String> scopes) {
4857

4958
validateNotEmpty("scopes", scopes);

src/main/java/com/microsoft/aad/msal4j/ClientSecret.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,17 @@
2929

3030

3131
/**
32-
* Credential including secret.
32+
* Representation of client credential containing a secret in string format
3333
*/
3434
@EqualsAndHashCode
3535
public final class ClientSecret implements IClientCredential {
3636

37-
/**
38-
* Gets the secret of the client requesting the token.
39-
*
40-
*/
37+
4138
@Accessors(fluent = true)
4239
@Getter
4340
private final String clientSecret;
4441

45-
/**
42+
/**
4643
* Constructor to create credential with client id and secret
4744
*
4845
* @param clientSecret

src/main/java/com/microsoft/aad/msal4j/ConfidentialClientApplication.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939

4040
import static com.microsoft.aad.msal4j.ParameterValidationUtils.validateNotNull;
4141

42+
/**
43+
* Class to be used to acquire tokens for confidential client applications (Web Apps, Web APIs,
44+
* and daemon applications).
45+
*/
4246
public class ConfidentialClientApplication extends ClientApplicationBase implements IConfidentialClientApplication {
4347

4448
@Override

src/main/java/com/microsoft/aad/msal4j/CredentialTypeEnum.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
@Accessors(fluent = true)
3232
@Getter
3333
@AllArgsConstructor
34-
public enum CredentialTypeEnum {
34+
enum CredentialTypeEnum {
3535

3636
ACCESS_TOKEN("AccessToken"),
3737
REFRESH_TOKEN("RefreshToken"),

0 commit comments

Comments
 (0)