25
25
import org .mitre .oauth2 .model .ClientDetailsEntity ;
26
26
import org .mitre .oauth2 .model .ClientDetailsEntity .AuthMethod ;
27
27
import org .mitre .oauth2 .service .ClientDetailsEntityService ;
28
+ import org .mitre .openid .connect .config .ConfigurationPropertiesBean ;
28
29
import org .springframework .beans .factory .annotation .Autowired ;
29
30
import org .springframework .security .core .GrantedAuthority ;
30
31
import org .springframework .security .core .authority .SimpleGrantedAuthority ;
@@ -54,6 +55,9 @@ public class UriEncodedClientUserDetailsService implements UserDetailsService {
54
55
@ Autowired
55
56
private ClientDetailsEntityService clientDetailsService ;
56
57
58
+ @ Autowired
59
+ private ConfigurationPropertiesBean config ;
60
+
57
61
@ Override
58
62
public UserDetails loadUserByUsername (String clientId ) throws UsernameNotFoundException {
59
63
@@ -66,9 +70,10 @@ public UserDetails loadUserByUsername(String clientId) throws UsernameNotFoundE
66
70
67
71
String encodedPassword = UriUtils .encodeQueryParam (Strings .nullToEmpty (client .getClientSecret ()), "UTF-8" );
68
72
69
- if (client .getTokenEndpointAuthMethod () != null &&
70
- (client .getTokenEndpointAuthMethod ().equals (AuthMethod .PRIVATE_KEY ) ||
71
- client .getTokenEndpointAuthMethod ().equals (AuthMethod .SECRET_JWT ))) {
73
+ if (config .isHeartMode () || // if we're running HEART mode turn off all client secrets
74
+ (client .getTokenEndpointAuthMethod () != null &&
75
+ (client .getTokenEndpointAuthMethod ().equals (AuthMethod .PRIVATE_KEY ) ||
76
+ client .getTokenEndpointAuthMethod ().equals (AuthMethod .SECRET_JWT )))) {
72
77
73
78
// Issue a random password each time to prevent password auth from being used (or skipped)
74
79
// for private key or shared key clients, see #715
0 commit comments