4
4
import com .fasterxml .jackson .annotation .JsonIgnore ;
5
5
import com .fasterxml .jackson .annotation .JsonIgnoreProperties ;
6
6
import com .fasterxml .jackson .annotation .JsonInclude ;
7
+ import com .fasterxml .jackson .annotation .JsonProperty ;
7
8
import com .fasterxml .jackson .annotation .JsonSetter ;
9
+ import org .cloudfoundry .identity .uaa .client .ClientJwtConfiguration ;
8
10
import org .cloudfoundry .identity .uaa .client .UaaClientDetails ;
11
+ import org .cloudfoundry .identity .uaa .oauth .jwk .JsonWebKey ;
12
+ import org .cloudfoundry .identity .uaa .oauth .jwk .JsonWebKeySet ;
9
13
import org .cloudfoundry .identity .uaa .oauth .provider .ClientDetails ;
10
14
15
+ import java .util .List ;
16
+ import java .util .Objects ;
17
+
11
18
@ JsonInclude (JsonInclude .Include .NON_NULL )
12
19
@ JsonIgnoreProperties (ignoreUnknown = true )
13
20
public class ClientDetailsModification extends UaaClientDetails {
@@ -22,6 +29,15 @@ public class ClientDetailsModification extends UaaClientDetails {
22
29
@ JsonIgnore
23
30
private String action = NONE ;
24
31
32
+ @ JsonProperty ("jwks_uri" )
33
+ private String jwksUri ;
34
+
35
+ @ JsonProperty ("jwks" )
36
+ private transient JsonWebKeySet <JsonWebKey > jwkSet ;
37
+
38
+ @ JsonProperty ("jwt_creds" )
39
+ private transient List <ClientJwtCredential > clientJwtCredentials ;
40
+
25
41
public ClientDetailsModification () {
26
42
}
27
43
@@ -32,6 +48,12 @@ public ClientDetailsModification(ClientDetails prototype) {
32
48
if (baseClientDetails .getAutoApproveScopes () != null ) {
33
49
this .setAutoApproveScopes (baseClientDetails .getAutoApproveScopes ());
34
50
}
51
+ if (baseClientDetails .getClientJwtConfig () instanceof String ) {
52
+ ClientJwtConfiguration clientJwtConfiguration = ClientJwtConfiguration .readValue (baseClientDetails );
53
+ this .setJwksUri (clientJwtConfiguration .getJwksUri ());
54
+ this .setJwkSet (clientJwtConfiguration .getJwkSet ());
55
+ this .setClientJwtCredentials (clientJwtConfiguration .getClientJwtCredentials ());
56
+ }
35
57
}
36
58
if (prototype instanceof ClientDetailsModification modification ) {
37
59
this .action = modification .getAction ();
@@ -87,4 +109,63 @@ private boolean valid(String action) {
87
109
|| UPDATE_SECRET .equals (action )
88
110
|| SECRET .equals (action );
89
111
}
112
+
113
+ public String getJwksUri () {
114
+ return this .jwksUri ;
115
+ }
116
+
117
+ public void setJwksUri (String jwksUri ) {
118
+ this .jwksUri = jwksUri ;
119
+ }
120
+
121
+ public JsonWebKeySet <JsonWebKey > getJwkSet () {
122
+ return this .jwkSet ;
123
+ }
124
+
125
+ public void setJwkSet (final JsonWebKeySet <JsonWebKey > jwkSet ) {
126
+ this .jwkSet = jwkSet ;
127
+ }
128
+
129
+ public List <ClientJwtCredential > getClientJwtCredentials () {
130
+ return this .clientJwtCredentials ;
131
+ }
132
+
133
+ public void setClientJwtCredentials (final List <ClientJwtCredential > clientJwtCredentials ) {
134
+ this .clientJwtCredentials = clientJwtCredentials ;
135
+ }
136
+
137
+ @ Override
138
+ public boolean equals (Object other ) {
139
+ if (this == other ) {
140
+ return true ;
141
+ }
142
+ if (other == null || getClass () != other .getClass ()) {
143
+ return false ;
144
+ }
145
+ if (!super .equals (other )) {
146
+ return false ;
147
+ }
148
+ ClientDetailsModification that = (ClientDetailsModification ) other ;
149
+ if (!Objects .equals (jwksUri , that .jwksUri )) {
150
+ return false ;
151
+ }
152
+ if (!Objects .equals (jwkSet , that .jwkSet )) {
153
+ return false ;
154
+ }
155
+ if (!Objects .equals (clientJwtCredentials , that .clientJwtCredentials )) {
156
+ return false ;
157
+ }
158
+ return Objects .equals (action , that .action );
159
+ }
160
+
161
+ @ Override
162
+ public int hashCode () {
163
+ final int prime = 31 ;
164
+ int result = super .hashCode ();
165
+ result = prime * result + (action != null ? action .hashCode () : 0 );
166
+ result = prime * result + (jwksUri == null ? 0 : jwksUri .hashCode ());
167
+ result = prime * result + (jwkSet == null ? 0 : jwkSet .hashCode ());
168
+ result = prime * result + (clientJwtCredentials == null ? 0 : clientJwtCredentials .hashCode ());
169
+ return result ;
170
+ }
90
171
}
0 commit comments