spring boot init

spring boot init
This commit is contained in:
shimingxy
2019-09-04 23:47:22 +08:00
parent 6181f5d657
commit fb15e2b070
1192 changed files with 2693 additions and 4070 deletions

View File

@@ -1 +0,0 @@
/org/

View File

@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

View File

@@ -1 +0,0 @@
/org/

View File

@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

View File

@@ -80,7 +80,13 @@ renew [OPTIONAL] - if this parameter is set, ticket validation will only succeed
@RequestParam(value = CasConstants.PARAMETER.SERVICE) String service,
@RequestParam(value = CasConstants.PARAMETER.RENEW,required=false) String renew
){
Ticket storedTicket=ticketServices.consumeTicket(ticket);
Ticket storedTicket=null;
try {
storedTicket = ticketServices.consumeTicket(ticket);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(storedTicket!=null){
return new Service10ResponseBuilder().success()

View File

@@ -179,7 +179,13 @@ For all error codes, it is RECOMMENDED that CAS provide a more detailed message
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=CasConstants.FORMAT_TYPE.XML) String format){
Ticket storedTicket=ticketServices.consumeTicket(ticket);
Ticket storedTicket=null;
try {
storedTicket = ticketServices.consumeTicket(ticket);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ServiceResponseBuilder serviceResponseBuilder=new ServiceResponseBuilder();
if(storedTicket!=null){
@@ -276,7 +282,12 @@ Response on ticket validation failure:
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=CasConstants.FORMAT_TYPE.XML) String format){
Ticket storedTicket=ticketServices.consumeTicket(ticket);
Ticket storedTicket=null;
try {
storedTicket = ticketServices.consumeTicket(ticket);
} catch (Exception e) {
e.printStackTrace();
}
ServiceResponseBuilder serviceResponseBuilder=new ServiceResponseBuilder();
if(storedTicket!=null){

View File

@@ -61,7 +61,12 @@ public class Cas30AuthorizeEndpoint extends AuthorizeBaseEndpoint{
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=CasConstants.FORMAT_TYPE.XML) String format){
Ticket storedTicket=ticketServices.consumeTicket(ticket);
Ticket storedTicket=null;
try {
storedTicket = ticketServices.consumeTicket(ticket);
} catch (Exception e) {
e.printStackTrace();
}
ServiceResponseBuilder serviceResponseBuilder=new ServiceResponseBuilder();
if(storedTicket!=null){
@@ -98,7 +103,12 @@ public class Cas30AuthorizeEndpoint extends AuthorizeBaseEndpoint{
@RequestParam(value = CasConstants.PARAMETER.FORMAT,required=false,defaultValue=CasConstants.FORMAT_TYPE.XML) String format){
Ticket storedTicket=ticketServices.consumeTicket(ticket);
Ticket storedTicket=null;
try {
storedTicket = ticketServices.consumeTicket(ticket);
} catch (Exception e) {
e.printStackTrace();
}
ServiceResponseBuilder serviceResponseBuilder=new ServiceResponseBuilder();
if(storedTicket!=null){

View File

@@ -7,7 +7,7 @@ import java.sql.Types;
import javax.sql.DataSource;
import org.maxkey.authz.cas.endpoint.ticket.Ticket;
import org.maxkey.authz.oauth2.common.util.SerializationUtils;
import org.maxkey.util.SerializationUtils;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;

View File

@@ -3,7 +3,6 @@ package org.maxkey.authz.cas.endpoint.ticket.service;
import org.maxkey.authz.cas.endpoint.ticket.CasConstants;
import org.maxkey.authz.cas.endpoint.ticket.Ticket;
import org.maxkey.authz.cas.endpoint.ticket.generator.DefaultUniqueTicketIdGenerator;
import org.maxkey.authz.oauth2.common.exceptions.InvalidGrantException;
public abstract class RandomServiceTicketServices implements TicketServices {
@@ -39,11 +38,10 @@ public abstract class RandomServiceTicketServices implements TicketServices {
return ticketId;
}
public Ticket consumeTicket(String ticketId)
throws InvalidGrantException {
public Ticket consumeTicket(String ticketId) throws Exception{
Ticket ticket = this.remove(ticketId);
if (ticket == null) {
throw new InvalidGrantException("Invalid authorization code: " + ticketId);
throw new Exception("Invalid authorization code: " + ticketId);
}
return ticket;
}

View File

@@ -1,7 +1,6 @@
package org.maxkey.authz.cas.endpoint.ticket.service;
import org.maxkey.authz.cas.endpoint.ticket.Ticket;
import org.maxkey.authz.oauth2.common.exceptions.InvalidGrantException;
public interface TicketServices {
@@ -21,6 +20,6 @@ public interface TicketServices {
* @throws InvalidGrantException If the authorization code is invalid or expired.
*/
Ticket consumeTicket(String ticketId)
throws InvalidGrantException;
throws Exception;
}

View File

@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

View File

@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

View File

@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

View File

@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

View File

@@ -0,0 +1,2 @@
http\://www.springframework.org/schema/security/oauth2=org.springframework.security.oauth2.config.xml.OAuth2SecurityNamespaceHandler
http\://www.springframework.org/schema/security/oauth=org.springframework.security.oauth.config.OAuthSecurityNamespaceHandler

View File

@@ -0,0 +1,5 @@
http\://www.springframework.org/schema/security/spring-security-oauth2-1.0.xsd=org/springframework/security/oauth2/spring-security-oauth2-1.0.xsd
http\://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd=org/springframework/security/oauth2/spring-security-oauth2-2.0.xsd
http\://www.springframework.org/schema/security/spring-security-oauth2.xsd=org/springframework/security/oauth2/spring-security-oauth2-2.0.xsd
http\://www.springframework.org/schema/security/spring-security-oauth-1.0.xsd=org/springframework/security/oauth/spring-security-oauth-1.0.xsd
http\://www.springframework.org/schema/security/spring-security-oauth.xsd=org/springframework/security/oauth/spring-security-oauth-1.0.xsd

View File

@@ -5,6 +5,7 @@ dependencies {
compile fileTree(dir: '../maxkey-lib/*/', include: '*.jar')
compile project(":maxkey-core")
compile project(":maxkey-dao")
compile project(":maxkey-jose-jwt")
compile project(":maxkey-protocols:maxkey-protocol-authorize")

View File

@@ -1,57 +0,0 @@
package org.maxkey.authz.oauth2.common.util;
import java.io.*;
public class SerializationUtils {
public static byte[] serialize(Object state) {
ObjectOutputStream oos = null;
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream(512);
oos = new ObjectOutputStream(bos);
oos.writeObject(state);
oos.flush();
return bos.toByteArray();
}
catch (IOException e) {
throw new IllegalArgumentException(e);
}
finally {
if (oos != null) {
try {
oos.close();
}
catch (IOException e) {
// eat it
}
}
}
}
public static <T> T deserialize(byte[] byteArray) {
ObjectInputStream oip = null;
try {
oip = new ObjectInputStream(new ByteArrayInputStream(byteArray));
@SuppressWarnings("unchecked")
T result = (T) oip.readObject();
return result;
}
catch (IOException e) {
throw new IllegalArgumentException(e);
}
catch (ClassNotFoundException e) {
throw new IllegalArgumentException(e);
}
finally {
if (oip != null) {
try {
oip.close();
}
catch (IOException e) {
// eat it
}
}
}
}
}

View File

@@ -6,8 +6,8 @@ import java.sql.Types;
import javax.sql.DataSource;
import org.maxkey.authz.oauth2.common.util.SerializationUtils;
import org.maxkey.authz.oauth2.provider.OAuth2Authentication;
import org.maxkey.util.SerializationUtils;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;

View File

@@ -17,11 +17,11 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.maxkey.authz.oauth2.common.OAuth2AccessToken;
import org.maxkey.authz.oauth2.common.OAuth2RefreshToken;
import org.maxkey.authz.oauth2.common.util.SerializationUtils;
import org.maxkey.authz.oauth2.provider.OAuth2Authentication;
import org.maxkey.authz.oauth2.provider.token.AuthenticationKeyGenerator;
import org.maxkey.authz.oauth2.provider.token.DefaultAuthenticationKeyGenerator;
import org.maxkey.authz.oauth2.provider.token.TokenStore;
import org.maxkey.util.SerializationUtils;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;

View File

@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

View File

@@ -76,7 +76,7 @@ public class ConsumerEndpoint {
private String assertionConsumerServiceURL;
@Autowired
@Qualifier("bindingAdpater")
@Qualifier("extractRedirectBindingAdapter")
private ExtractBindingAdapter extractBindingAdapter;
@Autowired

View File

@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path: