This commit is contained in:
MaxKey
2022-01-18 14:21:49 +08:00
parent d4a8c19c6e
commit ff2cf5b82f
137 changed files with 872 additions and 912 deletions

View File

@@ -23,7 +23,7 @@ package org.maxkey.authz.endpoint;
import javax.servlet.http.HttpServletRequest;
import org.maxkey.constants.ConstantsProtocols;
import org.maxkey.constants.ConstsProtocols;
import org.maxkey.entity.apps.Apps;
import org.maxkey.persistence.service.AppsCasDetailsService;
import org.maxkey.web.WebConstants;
@@ -61,25 +61,25 @@ public class AuthorizeEndpoint extends AuthorizeBaseEndpoint{
Apps app=getApp(id);
WebContext.setAttribute(WebConstants.SINGLE_SIGN_ON_APP_ID, app.getId());
if(app.getProtocol().equalsIgnoreCase(ConstantsProtocols.EXTEND_API)){
if(app.getProtocol().equalsIgnoreCase(ConstsProtocols.EXTEND_API)){
modelAndView=WebContext.forward("/authz/api/"+app.getId());
}else if (app.getProtocol().equalsIgnoreCase(ConstantsProtocols.FORMBASED)){
}else if (app.getProtocol().equalsIgnoreCase(ConstsProtocols.FORMBASED)){
modelAndView=WebContext.forward("/authz/formbased/"+app.getId());
}else if (app.getProtocol().equalsIgnoreCase(ConstantsProtocols.OAUTH20)){
}else if (app.getProtocol().equalsIgnoreCase(ConstsProtocols.OAUTH20)){
modelAndView=WebContext.forward("/authz/oauth/v20/"+app.getId());
}else if (app.getProtocol().equalsIgnoreCase(ConstantsProtocols.OAUTH21)){
}else if (app.getProtocol().equalsIgnoreCase(ConstsProtocols.OAUTH21)){
modelAndView=WebContext.redirect(app.getLoginUrl());
}else if (app.getProtocol().equalsIgnoreCase(ConstantsProtocols.OPEN_ID_CONNECT10)){
}else if (app.getProtocol().equalsIgnoreCase(ConstsProtocols.OPEN_ID_CONNECT10)){
modelAndView=WebContext.forward("/authz/oauth/v20/"+app.getId());
}else if (app.getProtocol().equalsIgnoreCase(ConstantsProtocols.SAML20)){
}else if (app.getProtocol().equalsIgnoreCase(ConstsProtocols.SAML20)){
modelAndView=WebContext.forward("/authz/saml20/idpinit/"+app.getId());
}else if (app.getProtocol().equalsIgnoreCase(ConstantsProtocols.TOKENBASED)){
}else if (app.getProtocol().equalsIgnoreCase(ConstsProtocols.TOKENBASED)){
modelAndView=WebContext.forward("/authz/tokenbased/"+app.getId());
}else if (app.getProtocol().equalsIgnoreCase(ConstantsProtocols.CAS)){
}else if (app.getProtocol().equalsIgnoreCase(ConstsProtocols.CAS)){
modelAndView=WebContext.forward("/authz/cas/"+app.getId());
}else if (app.getProtocol().equalsIgnoreCase(ConstantsProtocols.JWT)){
}else if (app.getProtocol().equalsIgnoreCase(ConstsProtocols.JWT)){
modelAndView=WebContext.forward("/authz/jwt/"+app.getId());
}else if (app.getProtocol().equalsIgnoreCase(ConstantsProtocols.BASIC)){
}else if (app.getProtocol().equalsIgnoreCase(ConstsProtocols.BASIC)){
modelAndView=WebContext.redirect(app.getLoginUrl());
}

View File

@@ -20,7 +20,7 @@ package org.maxkey.authz.endpoint.adapter;
import java.io.UnsupportedEncodingException;
import org.apache.commons.codec.binary.Hex;
import org.maxkey.authn.SigninPrincipal;
import org.maxkey.constants.Boolean;
import org.maxkey.constants.ConstsBoolean;
import org.maxkey.crypto.Base64Utils;
import org.maxkey.crypto.ReciprocalUtils;
import org.maxkey.crypto.cert.CertSigner;
@@ -43,7 +43,7 @@ public abstract class AbstractAuthorizeAdapter {
public abstract String generateInfo(SigninPrincipal authentication,UserInfo userInfo,Object app);
public String sign(String data,Apps app){
if(Boolean.isTrue(app.getIsSignature())){
if(ConstsBoolean.isTrue(app.getIsSignature())){
KeyStoreLoader keyStoreLoader=WebContext.getBean("keyStoreLoader",KeyStoreLoader.class);
try {
byte[] signature= CertSigner.sign(data.getBytes(), keyStoreLoader.getKeyStore(), keyStoreLoader.getEntityName(), keyStoreLoader.getKeystorePassword());