jwk Pretty

This commit is contained in:
MaxKey 2022-02-14 16:11:57 +08:00
parent ade641922c
commit af88748489
4 changed files with 9 additions and 7 deletions

View File

@ -38,6 +38,7 @@ import org.maxkey.crypto.jose.keystore.JWKSetKeyStore;
import org.maxkey.entity.apps.Apps;
import org.maxkey.entity.apps.AppsJwtDetails;
import org.maxkey.persistence.service.AppsJwtDetailsService;
import org.maxkey.pretty.PrettyFactory;
import org.maxkey.util.Instance;
import org.maxkey.web.WebConstants;
import org.maxkey.web.WebContext;
@ -154,8 +155,10 @@ public class JwtAuthorizeEndpoint extends AuthorizeBaseEndpoint{
jwkSetString = jwkSetString + "," +jwtDetails.getAlgorithmKey();
}
}
JWKSetKeyStore jwkSetKeyStore = new JWKSetKeyStore("{\"keys\": [" + jwkSetString + "]}");
return jwkSetKeyStore.getJwkSet().toPublicJWKSet().toString();
return PrettyFactory.getJsonPretty().format(
jwkSetKeyStore.getJwkSet().toPublicJWKSet().toString());
}
}

View File

@ -46,6 +46,7 @@ import org.maxkey.crypto.jose.keystore.JWKSetKeyStore;
import org.maxkey.util.HttpEncoder;
import org.maxkey.entity.apps.Apps;
import org.maxkey.entity.apps.oauth2.provider.ClientDetails;
import org.maxkey.pretty.PrettyFactory;
import org.maxkey.web.WebConstants;
import org.maxkey.web.WebContext;
import org.slf4j.Logger;
@ -309,7 +310,8 @@ public class AuthorizationEndpoint extends AbstractEndpoint {
}
JWKSetKeyStore jwkSetKeyStore = new JWKSetKeyStore("{\"keys\": [" + jwkSetString + "]}");
return jwkSetKeyStore.getJwkSet().toPublicJWKSet().toString();
return PrettyFactory.getJsonPretty().format(
jwkSetKeyStore.getJwkSet().toPublicJWKSet().toString());
}
// We need explicit approval from the user.

View File

@ -36,7 +36,6 @@ import org.maxkey.authz.oauth2.provider.ClientDetailsService;
import org.maxkey.authz.oauth2.provider.OAuth2Authentication;
import org.maxkey.authz.oauth2.provider.token.DefaultTokenServices;
import org.maxkey.constants.ContentType;
import org.maxkey.crypto.jose.keystore.JWKSetKeyStore;
import org.maxkey.crypto.jwt.encryption.service.impl.DefaultJwtEncryptionAndDecryptionService;
import org.maxkey.crypto.jwt.signer.service.impl.DefaultJwtSigningAndValidationService;
import org.maxkey.entity.UserInfo;
@ -56,9 +55,7 @@ import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.nimbusds.jose.EncryptionMethod;
import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.JWEAlgorithm;
import com.nimbusds.jose.JWEHeader;
import com.nimbusds.jose.JWEObject;
import com.nimbusds.jose.JWSAlgorithm;

View File

@ -96,14 +96,14 @@
<tr>
<td width="120px"><@locale code="apps.name"/></td>
<td width="360px">
<div class="input-group mb-3" style="float: left;vertical-align: middle;">
<div class="input-group" style="float: left;vertical-align: middle;">
<input class="form-control d-none appId" id="appId" name="appId" value="" type="text" >
<input class="form-control d-none" id="parentId" name="parentId" value="" type="text" >
<input class="form-control appName" value="" id="appName" name="appName" type="text" >
<input class="button btn btn-primary mr-3 window" id="selectBtn" type="button" value="<@locale code="button.text.select"/>"
wurl="<@base/>/apps/select"
wwidth="700"
wheight="500"
wheight="550"
target="window">
</div>
</td>