|
@@ -13,6 +13,7 @@ import org.springframework.security.oauth2.provider.token.DefaultAuthenticationK
|
|
public class CustomAuthenticationKeyGenerator extends DefaultAuthenticationKeyGenerator {
|
|
public class CustomAuthenticationKeyGenerator extends DefaultAuthenticationKeyGenerator {
|
|
|
|
|
|
private static final String CLIENT_ID = "client_id";
|
|
private static final String CLIENT_ID = "client_id";
|
|
|
|
+ private static final String CLIENT_TYPE = "client_type";
|
|
|
|
|
|
private static final String SCOPE = "scope";
|
|
private static final String SCOPE = "scope";
|
|
|
|
|
|
@@ -25,10 +26,16 @@ public class CustomAuthenticationKeyGenerator extends DefaultAuthenticationKeyGe
|
|
if (!authentication.isClientOnly()) {
|
|
if (!authentication.isClientOnly()) {
|
|
values.put(USERNAME, StringUtils.substringAfter(authentication.getName(), ":"));
|
|
values.put(USERNAME, StringUtils.substringAfter(authentication.getName(), ":"));
|
|
}
|
|
}
|
|
- values.put(CLIENT_ID, authorizationRequest.getClientId());
|
|
|
|
|
|
+ String clientId = authorizationRequest.getClientId();
|
|
|
|
+ clientId = clientId.replace("QR_", "");
|
|
|
|
+ values.put(CLIENT_ID, clientId);
|
|
if (authorizationRequest.getScope() != null) {
|
|
if (authorizationRequest.getScope() != null) {
|
|
values.put(SCOPE, OAuth2Utils.formatParameterList(new TreeSet<String>(authorizationRequest.getScope())));
|
|
values.put(SCOPE, OAuth2Utils.formatParameterList(new TreeSet<String>(authorizationRequest.getScope())));
|
|
}
|
|
}
|
|
|
|
+ String deviceId = authorizationRequest.getRequestParameters().get(CLIENT_TYPE);
|
|
|
|
+ if (StringUtils.isNotBlank(deviceId)) {
|
|
|
|
+ values.put(CLIENT_TYPE, deviceId);
|
|
|
|
+ }
|
|
return generateKey(values);
|
|
return generateKey(values);
|
|
}
|
|
}
|
|
|
|
|