From f160f6ae5fb6d40f09e8457bacec44eccdccbd25 Mon Sep 17 00:00:00 2001 From: "shengzhaoli.shengz" Date: Mon, 16 Oct 2023 18:30:06 +0800 Subject: [PATCH] client, jsp -> html , test --- .../sos/web/controller/ClientDetailsController.java | 11 +++++++++-- .../OauthClientDetailsDtoValidator.java | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) rename src/main/java/com/monkeyk/sos/web/{oauth => controller}/OauthClientDetailsDtoValidator.java (98%) diff --git a/src/main/java/com/monkeyk/sos/web/controller/ClientDetailsController.java b/src/main/java/com/monkeyk/sos/web/controller/ClientDetailsController.java index 61fd490..64a971f 100644 --- a/src/main/java/com/monkeyk/sos/web/controller/ClientDetailsController.java +++ b/src/main/java/com/monkeyk/sos/web/controller/ClientDetailsController.java @@ -2,8 +2,9 @@ package com.monkeyk.sos.web.controller; import com.monkeyk.sos.service.dto.OauthClientDetailsDto; import com.monkeyk.sos.service.OauthService; -import com.monkeyk.sos.web.oauth.OauthClientDetailsDtoValidator; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.oauth2.core.AuthorizationGrantType; +import org.springframework.security.oauth2.core.oidc.OidcScopes; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; @@ -66,7 +67,13 @@ public class ClientDetailsController { */ @RequestMapping(value = "register_client", method = RequestMethod.GET) public String registerClient(Model model) { - model.addAttribute("formDto", new OauthClientDetailsDto()); + OauthClientDetailsDto formDto = new OauthClientDetailsDto(); + //初始化 v3.0.0 added + formDto.setClientAuthenticationMethods("client_secret_basic"); + formDto.setScopes(OidcScopes.OPENID); + formDto.setAuthorizationGrantTypes(AuthorizationGrantType.AUTHORIZATION_CODE.getValue()); + + model.addAttribute("formDto", formDto); return "clientdetails/register_client"; } diff --git a/src/main/java/com/monkeyk/sos/web/oauth/OauthClientDetailsDtoValidator.java b/src/main/java/com/monkeyk/sos/web/controller/OauthClientDetailsDtoValidator.java similarity index 98% rename from src/main/java/com/monkeyk/sos/web/oauth/OauthClientDetailsDtoValidator.java rename to src/main/java/com/monkeyk/sos/web/controller/OauthClientDetailsDtoValidator.java index fcfe942..86c771f 100644 --- a/src/main/java/com/monkeyk/sos/web/oauth/OauthClientDetailsDtoValidator.java +++ b/src/main/java/com/monkeyk/sos/web/controller/OauthClientDetailsDtoValidator.java @@ -1,4 +1,4 @@ -package com.monkeyk.sos.web.oauth; +package com.monkeyk.sos.web.controller; import com.monkeyk.sos.service.dto.OauthClientDetailsDto; import com.monkeyk.sos.service.OauthService;