spring boot init
spring boot init
This commit is contained in:
@@ -1 +0,0 @@
|
||||
/org/
|
||||
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Class-Path:
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
/org/
|
||||
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Class-Path:
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Class-Path:
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Class-Path:
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Class-Path:
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Class-Path:
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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")
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Class-Path:
|
||||
|
||||
@@ -76,7 +76,7 @@ public class ConsumerEndpoint {
|
||||
private String assertionConsumerServiceURL;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("bindingAdpater")
|
||||
@Qualifier("extractRedirectBindingAdapter")
|
||||
private ExtractBindingAdapter extractBindingAdapter;
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Class-Path:
|
||||
|
||||
Reference in New Issue
Block a user