Constants For http

This commit is contained in:
MaxKey
2021-03-15 11:02:25 +08:00
parent bdd8919bf2
commit 4e13c96961
8 changed files with 18 additions and 18 deletions

View File

@@ -34,7 +34,7 @@ import org.maxkey.authz.endpoint.adapter.AbstractAuthorizeAdapter;
import org.maxkey.constants.Boolean;
import org.maxkey.domain.UserInfo;
import org.maxkey.util.Instance;
import org.maxkey.web.ResponseConstants;
import org.maxkey.web.HttpResponseConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
@@ -180,7 +180,7 @@ For all error codes, it is RECOMMENDED that CAS provide a more detailed message
@RequestParam(value = CasConstants.PARAMETER.SERVICE) String service,
@RequestParam(value = CasConstants.PARAMETER.PROXY_CALLBACK_URL,required=false) String pgtUrl,
@RequestParam(value = CasConstants.PARAMETER.RENEW,required=false) String renew,
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=ResponseConstants.FORMAT_TYPE.XML) String format){
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
_logger.debug("serviceValidate "
+ " ticket " + ticket
+" , service " + service
@@ -303,7 +303,7 @@ Response on ticket validation failure:
@RequestParam(value = CasConstants.PARAMETER.SERVICE) String service,
@RequestParam(value = CasConstants.PARAMETER.PROXY_CALLBACK_URL,required=false) String pgtUrl,
@RequestParam(value = CasConstants.PARAMETER.RENEW,required=false) String renew,
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=ResponseConstants.FORMAT_TYPE.XML) String format){
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
_logger.debug("proxyValidate "
+ " ticket " + ticket
+" , service " + service
@@ -402,7 +402,7 @@ For all error codes, it is RECOMMENDED that CAS provide a more detailed message
HttpServletResponse response,
@RequestParam(value = CasConstants.PARAMETER.PROXY_GRANTING_TICKET) String pgt,
@RequestParam(value = CasConstants.PARAMETER.TARGET_SERVICE) String targetService,
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=ResponseConstants.FORMAT_TYPE.XML) String format){
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
_logger.debug("proxy "
+ " pgt " + pgt
+" , targetService " + targetService

View File

@@ -35,7 +35,7 @@ import org.maxkey.authz.endpoint.adapter.AbstractAuthorizeAdapter;
import org.maxkey.constants.Boolean;
import org.maxkey.domain.UserInfo;
import org.maxkey.util.Instance;
import org.maxkey.web.ResponseConstants;
import org.maxkey.web.HttpResponseConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
@@ -63,7 +63,7 @@ public class Cas30AuthorizeEndpoint extends CasBaseAuthorizeEndpoint{
@RequestParam(value = CasConstants.PARAMETER.SERVICE) String service,
@RequestParam(value = CasConstants.PARAMETER.PROXY_CALLBACK_URL,required=false) String pgtUrl,
@RequestParam(value = CasConstants.PARAMETER.RENEW,required=false) String renew,
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=ResponseConstants.FORMAT_TYPE.XML) String format){
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
_logger.debug("serviceValidate "
+ " ticket " + ticket
+" , service " + service
@@ -122,7 +122,7 @@ public class Cas30AuthorizeEndpoint extends CasBaseAuthorizeEndpoint{
HttpServletResponse response,
@RequestParam(value = CasConstants.PARAMETER.PROXY_GRANTING_TICKET) String pgt,
@RequestParam(value = CasConstants.PARAMETER.TARGET_SERVICE) String targetService,
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=ResponseConstants.FORMAT_TYPE.XML) String format){
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
_logger.debug("proxy "
+ " pgt " + pgt
+" , targetService " + targetService
@@ -150,7 +150,7 @@ public class Cas30AuthorizeEndpoint extends CasBaseAuthorizeEndpoint{
@RequestParam(value = CasConstants.PARAMETER.SERVICE) String service,
@RequestParam(value = CasConstants.PARAMETER.PROXY_CALLBACK_URL,required=false) String pgtUrl,
@RequestParam(value = CasConstants.PARAMETER.RENEW,required=false) String renew,
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=ResponseConstants.FORMAT_TYPE.XML) String format){
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=HttpResponseConstants.FORMAT_TYPE.XML) String format){
_logger.debug("proxyValidate "
+ " ticket " + ticket
+" , service " + service

View File

@@ -31,7 +31,7 @@ import org.maxkey.authz.cas.endpoint.ticket.ServiceTicketImpl;
import org.maxkey.authz.cas.endpoint.ticket.TicketGrantingTicketImpl;
import org.maxkey.domain.UserInfo;
import org.maxkey.domain.apps.AppsCasDetails;
import org.maxkey.web.ResponseConstants;
import org.maxkey.web.HttpResponseConstants;
import org.maxkey.web.WebContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -196,7 +196,7 @@ public class CasRestV1Endpoint extends CasBaseAuthorizeEndpoint{
HttpHeaders headers = new HttpHeaders();
headers.add("location", location);
ServiceResponseBuilder serviceResponseBuilder=new ServiceResponseBuilder();
serviceResponseBuilder.setFormat(ResponseConstants.FORMAT_TYPE.JSON);
serviceResponseBuilder.setFormat(HttpResponseConstants.FORMAT_TYPE.JSON);
//for user
serviceResponseBuilder.setAttribute("uid", userInfo.getId());
serviceResponseBuilder.setAttribute("displayName",userInfo.getDisplayName());

View File

@@ -19,7 +19,7 @@ package org.maxkey.authz.cas.endpoint.response;
import java.util.ArrayList;
import java.util.HashMap;
import org.maxkey.web.ResponseConstants;
import org.maxkey.web.HttpResponseConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -31,7 +31,7 @@ public class CasServiceResponse {
protected boolean result=false;
protected String user;
protected String ticket;
protected String format=ResponseConstants.FORMAT_TYPE.XML;
protected String format=HttpResponseConstants.FORMAT_TYPE.XML;
protected ArrayList<String >proxies=new ArrayList<String>();
protected HashMap<String,ArrayList<String>>casAttributes=new HashMap<String,ArrayList<String>>();

View File

@@ -17,7 +17,7 @@
package org.maxkey.authz.cas.endpoint.response;
import org.maxkey.web.ResponseConstants;
import org.maxkey.web.HttpResponseConstants;
public class ProxyServiceResponseBuilder extends ServiceResponseBuilder{
@@ -28,7 +28,7 @@ public class ProxyServiceResponseBuilder extends ServiceResponseBuilder{
@Override
public String serviceResponseBuilder() {
String responseString = "";
if(format.equalsIgnoreCase(ResponseConstants.FORMAT_TYPE.XML)){
if(format.equalsIgnoreCase(HttpResponseConstants.FORMAT_TYPE.XML)){
responseString = serviceResponseXmlBuilder();
}else{
responseString =serviceResponseJsonBuilder();

View File

@@ -19,7 +19,7 @@ package org.maxkey.authz.cas.endpoint.response;
import java.util.ArrayList;
import java.util.Iterator;
import org.maxkey.web.ResponseConstants;
import org.maxkey.web.HttpResponseConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -29,7 +29,7 @@ public class ServiceResponseBuilder extends CasServiceResponse {
@Override
public String serviceResponseBuilder() {
String responseString = "";
if(format.equalsIgnoreCase(ResponseConstants.FORMAT_TYPE.XML)){
if(format.equalsIgnoreCase(HttpResponseConstants.FORMAT_TYPE.XML)){
responseString= serviceResponseXmlBuilder();
}else{
responseString= serviceResponseJsonBuilder();