@@ -19,36 +19,45 @@ class OAuthAuthorizationGrant extends AbstractMsalAuthorizationGrant {
1919 *
2020 * @param params parameters relevant for the specific authorization grant type
2121 * @param scopes additional scopes which will be added to a default set of common scopes
22- * @param claims optional claims
2322 */
24- OAuthAuthorizationGrant (Map <String , List <String >> params , Set <String > scopes , ClaimsRequest claims ) {
23+ OAuthAuthorizationGrant (Map <String , List <String >> params , Set <String > scopes ) {
2524 this .scopes = new HashSet <>(AbstractMsalAuthorizationGrant .COMMON_SCOPES );
2625
2726 if (scopes != null ) {
2827 this .scopes .addAll (scopes );
2928 }
3029
30+ // Default scopes that apply to most flows
3131 this .params .put (SCOPE_PARAM_NAME , Collections .singletonList (String .join (" " , this .scopes )));
32+ // Parameter to request client info from the endpoint
33+ this .params .put ("client_info" , Collections .singletonList ("1" ));
3234
3335 if (params != null ) {
3436 this .params .putAll (params );
3537 }
38+ }
3639
37- if (claims != null ) {
38- this .claims = claims ;
39- this .params .put ("claims" , Collections .singletonList (claims .formatAsJSONString ()));
40+ /**
41+ * Constructor to create an OAuthAuthorizationGrant
42+ *
43+ * @param params parameters relevant for the specific authorization grant type
44+ * @param scopes additional scopes which will be added to a default set of common scopes
45+ * @param claims optional claims
46+ */
47+ OAuthAuthorizationGrant (Map <String , List <String >> params , Set <String > scopes , ClaimsRequest claims ) {
48+ this (params , scopes );
49+
50+ if (claims != null ) {
51+ this .claims = claims ;
52+ this .params .put ("claims" , Collections .singletonList (claims .formatAsJSONString ()));
53+ }
4054 }
41- }
4255
4356 /**
44- * Returns an unmodifiable version of the parameters map, and adds the client_info parameter
57+ * Returns an unmodifiable version of the parameters map
4558 */
4659 @ Override
4760 public Map <String , List <String >> toParameters () {
48- final Map <String , List <String >> outParams = new LinkedHashMap <>(params );
49-
50- outParams .put ("client_info" , Collections .singletonList ("1" ));
51-
52- return Collections .unmodifiableMap (outParams );
61+ return Collections .unmodifiableMap (new LinkedHashMap <>(params ));
5362 }
5463}
0 commit comments