Skip to content

Commit 943f1da

Browse files
committed
Add Jwt Client Authentication support
Closes gh-8175
1 parent dd3b903 commit 943f1da

File tree

39 files changed

+3451
-333
lines changed

39 files changed

+3451
-333
lines changed

oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/AbstractOAuth2AuthorizationGrantRequest.java

+33-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.security.oauth2.client.endpoint;
1818

19+
import org.springframework.security.oauth2.client.registration.ClientRegistration;
1920
import org.springframework.security.oauth2.core.AuthorizationGrantType;
2021
import org.springframework.util.Assert;
2122

@@ -27,20 +28,42 @@
2728
* @author Joe Grandja
2829
* @since 5.0
2930
* @see AuthorizationGrantType
31+
* @see ClientRegistration
3032
* @see <a target="_blank" href="https://tools.ietf.org/html/rfc6749#section-1.3">Section
3133
* 1.3 Authorization Grant</a>
3234
*/
3335
public abstract class AbstractOAuth2AuthorizationGrantRequest {
3436

3537
private final AuthorizationGrantType authorizationGrantType;
3638

39+
private final ClientRegistration clientRegistration;
40+
3741
/**
3842
* Sub-class constructor.
3943
* @param authorizationGrantType the authorization grant type
44+
* @deprecated Use
45+
* {@link #AbstractOAuth2AuthorizationGrantRequest(AuthorizationGrantType, ClientRegistration)}
46+
* instead
4047
*/
48+
@Deprecated
4149
protected AbstractOAuth2AuthorizationGrantRequest(AuthorizationGrantType authorizationGrantType) {
4250
Assert.notNull(authorizationGrantType, "authorizationGrantType cannot be null");
4351
this.authorizationGrantType = authorizationGrantType;
52+
this.clientRegistration = null;
53+
}
54+
55+
/**
56+
* Sub-class constructor.
57+
* @param authorizationGrantType the authorization grant type
58+
* @param clientRegistration the client registration
59+
* @since 5.5
60+
*/
61+
protected AbstractOAuth2AuthorizationGrantRequest(AuthorizationGrantType authorizationGrantType,
62+
ClientRegistration clientRegistration) {
63+
Assert.notNull(authorizationGrantType, "authorizationGrantType cannot be null");
64+
Assert.notNull(clientRegistration, "clientRegistration cannot be null");
65+
this.authorizationGrantType = authorizationGrantType;
66+
this.clientRegistration = clientRegistration;
4467
}
4568

4669
/**
@@ -51,4 +74,13 @@ public AuthorizationGrantType getGrantType() {
5174
return this.authorizationGrantType;
5275
}
5376

77+
/**
78+
* Returns the {@link ClientRegistration client registration}.
79+
* @return the {@link ClientRegistration}
80+
* @since 5.5
81+
*/
82+
public ClientRegistration getClientRegistration() {
83+
return this.clientRegistration;
84+
}
85+
5486
}

0 commit comments

Comments
 (0)