本文整理汇总了Java中org.jasig.cas.ticket.ServiceTicketImpl类的典型用法代码示例。如果您正苦于以下问题:Java ServiceTicketImpl类的具体用法?Java ServiceTicketImpl怎么用?Java ServiceTicketImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceTicketImpl类属于org.jasig.cas.ticket包,在下文中一共展示了ServiceTicketImpl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: deleteTicketGrantingTickets
import org.jasig.cas.ticket.ServiceTicketImpl; //导入依赖的package包/类
/**
* Delete ticket granting tickets int.
*
* @param ticketId the ticket id
* @return the int
*/
public int deleteTicketGrantingTickets(final String ticketId) {
int failureCount = 0;
final List<ServiceTicketImpl> serviceTicketImpls = getTicketQueryResultList(ticketId,
"select s from "
+ TABLE_SERVICE_TICKETS
+ " s where s.ticketGrantingTicket.id = :id", ServiceTicketImpl.class);
failureCount += deleteTicketsFromResultList(serviceTicketImpls);
List<TicketGrantingTicketImpl> ticketGrantingTicketImpls = getTicketQueryResultList(ticketId,
"select t from " + TABLE_TICKET_GRANTING_TICKETS
+ " t where t.ticketGrantingTicket.id = :id", TicketGrantingTicketImpl.class);
failureCount += deleteTicketsFromResultList(ticketGrantingTicketImpls);
ticketGrantingTicketImpls = getTicketQueryResultList(ticketId,
"select t from " + TABLE_TICKET_GRANTING_TICKETS
+ " t where t.id = :id", TicketGrantingTicketImpl.class);
failureCount += deleteTicketsFromResultList(ticketGrantingTicketImpls);
return failureCount;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:28,代码来源:JpaTicketRegistry.java
示例2: deleteTicketAndChildren
import org.jasig.cas.ticket.ServiceTicketImpl; //导入依赖的package包/类
/**
* Delete the TGt and all of its service tickets.
*
* @param ticket the ticket
*/
private void deleteTicketAndChildren(final Ticket ticket) {
final List<TicketGrantingTicketImpl> ticketGrantingTicketImpls = entityManager
.createQuery("select t from TicketGrantingTicketImpl t where t.ticketGrantingTicket.id = :id",
TicketGrantingTicketImpl.class)
.setLockMode(LockModeType.PESSIMISTIC_WRITE)
.setParameter("id", ticket.getId())
.getResultList();
final List<ServiceTicketImpl> serviceTicketImpls = entityManager
.createQuery("select s from ServiceTicketImpl s where s.ticketGrantingTicket.id = :id",
ServiceTicketImpl.class)
.setParameter("id", ticket.getId())
.getResultList();
for (final ServiceTicketImpl s : serviceTicketImpls) {
removeTicket(s);
}
for (final TicketGrantingTicketImpl t : ticketGrantingTicketImpls) {
deleteTicketAndChildren(t);
}
removeTicket(ticket);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:29,代码来源:JpaTicketRegistry.java
示例3: getTickets
import org.jasig.cas.ticket.ServiceTicketImpl; //导入依赖的package包/类
@Transactional(readOnly=true)
@Override
public Collection<Ticket> getTickets() {
final List<TicketGrantingTicketImpl> tgts = entityManager
.createQuery("select t from TicketGrantingTicketImpl t", TicketGrantingTicketImpl.class)
.getResultList();
final List<ServiceTicketImpl> sts = entityManager
.createQuery("select s from ServiceTicketImpl s", ServiceTicketImpl.class)
.getResultList();
final List<Ticket> tickets = new ArrayList<>();
tickets.addAll(tgts);
tickets.addAll(sts);
return tickets;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:17,代码来源:JpaTicketRegistry.java
示例4: deleteTicketAndChildren
import org.jasig.cas.ticket.ServiceTicketImpl; //导入依赖的package包/类
private void deleteTicketAndChildren(final Ticket ticket) {
final List<TicketGrantingTicketImpl> ticketGrantingTicketImpls = entityManager
.createQuery("select t from TicketGrantingTicketImpl t where t.ticketGrantingTicket.id = :id",
TicketGrantingTicketImpl.class)
.setLockMode(LockModeType.PESSIMISTIC_WRITE)
.setParameter("id", ticket.getId())
.getResultList();
final List<ServiceTicketImpl> serviceTicketImpls = entityManager
.createQuery("select s from ServiceTicketImpl s where s.ticketGrantingTicket.id = :id",
ServiceTicketImpl.class)
.setParameter("id", ticket.getId())
.getResultList();
for (final ServiceTicketImpl s : serviceTicketImpls) {
removeTicket(s);
}
for (final TicketGrantingTicketImpl t : ticketGrantingTicketImpls) {
deleteTicketAndChildren(t);
}
removeTicket(ticket);
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:24,代码来源:JpaTicketRegistry.java
示例5: KryoTranscoderTests
import org.jasig.cas.ticket.ServiceTicketImpl; //导入依赖的package包/类
public KryoTranscoderTests(final int bufferSize) {
this.principalAttributes = new HashMap<String, Object>();
this.principalAttributes.put(ST_ID, TGT_ID);
transcoder = new KryoTranscoder(bufferSize);
final Map<Class<?>, Serializer> serializerMap = new HashMap<Class<?>, Serializer>();
serializerMap.put(
MockServiceTicket.class,
new FieldSerializer(transcoder.getKryo(), MockServiceTicket.class));
serializerMap.put(
MockTicketGrantingTicket.class,
new FieldSerializer(transcoder.getKryo(), MockTicketGrantingTicket.class));
serializerMap.put(
TicketGrantingTicketImpl.class,
new FieldSerializer(transcoder.getKryo(), TicketGrantingTicketImpl.class));
serializerMap.put(
ServiceTicketImpl.class,
new FieldSerializer(transcoder.getKryo(), ServiceTicketImpl.class));
transcoder.setSerializerMap(serializerMap);
transcoder.initialize();
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:23,代码来源:KryoTranscoderTests.java
示例6: getRawTicket
import org.jasig.cas.ticket.ServiceTicketImpl; //导入依赖的package包/类
/**
* Gets the ticket from the database, as is.
*
* @param ticketId the ticket id
* @return the raw ticket
*/
public Ticket getRawTicket(final String ticketId) {
try {
if (ticketId.startsWith(TicketGrantingTicket.PREFIX)
|| ticketId.startsWith(ProxyGrantingTicket.PROXY_GRANTING_TICKET_PREFIX)) {
// There is no need to distinguish between TGTs and PGTs since PGTs inherit from TGTs
return entityManager.find(TicketGrantingTicketImpl.class, ticketId);
}
return entityManager.find(ServiceTicketImpl.class, ticketId);
} catch (final Exception e) {
logger.error("Error getting ticket {} from registry.", ticketId, e);
}
return null;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:21,代码来源:JpaTicketRegistry.java
示例7: getTickets
import org.jasig.cas.ticket.ServiceTicketImpl; //导入依赖的package包/类
@Override
public Collection<Ticket> getTickets() {
final List<TicketGrantingTicketImpl> tgts = entityManager
.createQuery("select t from TicketGrantingTicketImpl t", TicketGrantingTicketImpl.class)
.getResultList();
final List<ServiceTicketImpl> sts = entityManager
.createQuery("select s from ServiceTicketImpl s", ServiceTicketImpl.class)
.getResultList();
final List<Ticket> tickets = new ArrayList<>();
tickets.addAll(tgts);
tickets.addAll(sts);
return tickets;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:16,代码来源:JpaTicketRegistry.java
示例8: verifyExpiredServiceTicket
import org.jasig.cas.ticket.ServiceTicketImpl; //导入依赖的package包/类
@Test
public void verifyExpiredServiceTicket() throws Exception {
clearAllServices();
final MockHttpServletRequest mockRequest = new MockHttpServletRequest("GET", CONTEXT
+ OAuthConstants.ACCESS_TOKEN_URL);
mockRequest.setParameter(OAuthConstants.CLIENT_ID, CLIENT_ID);
mockRequest.setParameter(OAuthConstants.REDIRECT_URI, REDIRECT_URI);
mockRequest.setParameter(OAuthConstants.CLIENT_SECRET, CLIENT_SECRET);
mockRequest.setParameter(OAuthConstants.CODE, CODE);
final MockHttpServletResponse mockResponse = new MockHttpServletResponse();
((OAuth20WrapperController) oauth20WrapperController)
.getServicesManager().save(getRegisteredService(REDIRECT_URI, CLIENT_SECRET));
final Map<String, Object> map = new HashMap<>();
map.put(NAME, VALUE);
final List<String> list = Arrays.asList(VALUE, VALUE);
map.put(NAME2, list);
final Principal p = org.jasig.cas.authentication.TestUtils.getPrincipal(ID, map);
final TicketGrantingTicketImpl impl = new TicketGrantingTicketImpl(TGT_ID,
org.jasig.cas.authentication.TestUtils.getAuthentication(p), new NeverExpiresExpirationPolicy());
((OAuth20WrapperController) oauth20WrapperController)
.getTicketRegistry().addTicket(new ServiceTicketImpl("ST1", impl,
org.jasig.cas.authentication.TestUtils.getService(), false,
new ExpirationPolicy() {
private static final long serialVersionUID = -7321055962209199811L;
@Override
public boolean isExpired(final TicketState ticketState) {
return true;
}
}));
oauth20WrapperController.handleRequest(mockRequest, mockResponse);
assertEquals(400, mockResponse.getStatus());
assertEquals("error=" + OAuthConstants.INVALID_GRANT, mockResponse.getContentAsString());
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:40,代码来源:OAuth20AccessTokenControllerTests.java
示例9: getRawTicket
import org.jasig.cas.ticket.ServiceTicketImpl; //导入依赖的package包/类
/**
* Gets the ticket from the database, as is.
*
* @param ticketId the ticket id
* @return the raw ticket
*/
private Ticket getRawTicket(final String ticketId) {
try {
if (ticketId.startsWith(this.ticketGrantingTicketPrefix)) {
return entityManager.find(TicketGrantingTicketImpl.class, ticketId, LockModeType.PESSIMISTIC_WRITE);
}
return entityManager.find(ServiceTicketImpl.class, ticketId);
} catch (final Exception e) {
logger.error("Error getting ticket {} from registry.", ticketId, e);
}
return null;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:19,代码来源:JpaTicketRegistry.java
示例10: getRawTicket
import org.jasig.cas.ticket.ServiceTicketImpl; //导入依赖的package包/类
private Ticket getRawTicket(final String ticketId) {
try {
if (ticketId.startsWith(this.ticketGrantingTicketPrefix)) {
return entityManager.find(TicketGrantingTicketImpl.class, ticketId, LockModeType.PESSIMISTIC_WRITE);
}
return entityManager.find(ServiceTicketImpl.class, ticketId);
} catch (final Exception e) {
logger.error("Error getting ticket {} from registry.", ticketId, e);
}
return null;
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:13,代码来源:JpaTicketRegistry.java
示例11: getTickets
import org.jasig.cas.ticket.ServiceTicketImpl; //导入依赖的package包/类
@Transactional(readOnly=true)
public Collection<Ticket> getTickets() {
final List<TicketGrantingTicketImpl> tgts = entityManager
.createQuery("select t from TicketGrantingTicketImpl t", TicketGrantingTicketImpl.class)
.getResultList();
final List<ServiceTicketImpl> sts = entityManager
.createQuery("select s from ServiceTicketImpl s", ServiceTicketImpl.class)
.getResultList();
final List<Ticket> tickets = new ArrayList<Ticket>();
tickets.addAll(tgts);
tickets.addAll(sts);
return tickets;
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:16,代码来源:JpaTicketRegistry.java
示例12: getRawTicket
import org.jasig.cas.ticket.ServiceTicketImpl; //导入依赖的package包/类
/**
* Gets the ticket from the database, as is.
*
* @param ticketId the ticket id
* @return the raw ticket
*/
private Ticket getRawTicket(final String ticketId) {
try {
if (ticketId.startsWith(TicketGrantingTicket.PREFIX)
|| ticketId.startsWith(ProxyGrantingTicket.PROXY_GRANTING_TICKET_PREFIX)) {
// There is no need to distinguish between TGTs and PGTs since PGTs inherit from TGTs
return entityManager.find(TicketGrantingTicketImpl.class, ticketId);
}
return entityManager.find(ServiceTicketImpl.class, ticketId);
} catch (final Exception e) {
logger.error("Error getting ticket {} from registry.", ticketId, e);
}
return null;
}
开发者ID:yuweijun,项目名称:cas-server-4.2.1,代码行数:21,代码来源:JpaTicketRegistry.java
示例13: getRawTicket
import org.jasig.cas.ticket.ServiceTicketImpl; //导入依赖的package包/类
/**
* Gets the ticket from the database, as is.
*
* @param ticketId the ticket id
* @return the raw ticket
*/
private Ticket getRawTicket(final String ticketId) {
try {
if (ticketId.startsWith(TicketGrantingTicket.PREFIX)
|| ticketId.startsWith(TicketGrantingTicket.PROXY_GRANTING_TICKET_PREFIX)) {
return entityManager.find(TicketGrantingTicketImpl.class, ticketId);
}
return entityManager.find(ServiceTicketImpl.class, ticketId);
} catch (final Exception e) {
logger.error("Error getting ticket {} from registry.", ticketId, e);
}
return null;
}
开发者ID:xuchengdong,项目名称:cas4.1.9,代码行数:20,代码来源:JpaTicketRegistry.java
示例14: initialize
import org.jasig.cas.ticket.ServiceTicketImpl; //导入依赖的package包/类
public void initialize() {
// Register types we know about and do not require external configuration
kryo.register(ArrayList.class);
kryo.register(BasicCredentialMetaData.class);
kryo.register(Class.class, new ClassSerializer(kryo));
kryo.register(Date.class, new DateSerializer());
kryo.register(HardTimeoutExpirationPolicy.class);
kryo.register(HashMap.class);
kryo.register(HandlerResult.class);
kryo.register(ImmutableAuthentication.class);
kryo.register(MultiTimeUseOrTimeoutExpirationPolicy.class);
kryo.register(NeverExpiresExpirationPolicy.class);
kryo.register(RememberMeDelegatingExpirationPolicy.class);
kryo.register(ServiceTicketImpl.class);
kryo.register(SimpleWebApplicationServiceImpl.class, new SimpleWebApplicationServiceSerializer(kryo));
kryo.register(ThrottledUseAndTimeoutExpirationPolicy.class);
kryo.register(TicketGrantingTicketExpirationPolicy.class);
kryo.register(TicketGrantingTicketImpl.class);
kryo.register(TimeoutExpirationPolicy.class);
kryo.register(URL.class, new URLSerializer(kryo));
// Register other types
if (serializerMap != null) {
for (final Class<?> clazz : serializerMap.keySet()) {
kryo.register(clazz, serializerMap.get(clazz));
}
}
// Catchall for any classes not explicitly registered
kryo.setRegistrationOptional(true);
}
开发者ID:kevin3061,项目名称:cas-4.0.1,代码行数:32,代码来源:KryoTranscoder.java
示例15: verifyOK
import org.jasig.cas.ticket.ServiceTicketImpl; //导入依赖的package包/类
@Test
public void verifyOK() throws Exception {
final MockHttpServletRequest mockRequest = new MockHttpServletRequest("GET", CONTEXT
+ OAuthConstants.ACCESS_TOKEN_URL);
mockRequest.setParameter(OAuthConstants.CLIENT_ID, CLIENT_ID);
mockRequest.setParameter(OAuthConstants.REDIRECT_URI, REDIRECT_URI);
mockRequest.setParameter(OAuthConstants.CLIENT_SECRET, CLIENT_SECRET);
mockRequest.setParameter(OAuthConstants.CODE, CODE);
final MockHttpServletResponse mockResponse = new MockHttpServletResponse();
((OAuth20WrapperController) oauth20WrapperController)
.getServicesManager().save(getRegisteredService(REDIRECT_URI, CLIENT_SECRET));
final Map<String, Object> map = new HashMap<>();
map.put(NAME, VALUE);
final List<String> list = Arrays.asList(VALUE, VALUE);
map.put(NAME2, list);
final Principal p = org.jasig.cas.authentication.TestUtils.getPrincipal(ID, map);
final TicketGrantingTicketImpl impl = new TicketGrantingTicketImpl(TGT_ID,
org.jasig.cas.authentication.TestUtils.getAuthentication(p), new NeverExpiresExpirationPolicy());
((OAuth20WrapperController) oauth20WrapperController)
.getTicketRegistry().addTicket(new ServiceTicketImpl(CODE, impl,
org.jasig.cas.authentication.TestUtils.getService(), false,
new ExpirationPolicy() {
private static final long serialVersionUID = -7321055962209199811L;
@Override
public boolean isExpired(final TicketState ticketState) {
return false;
}
}));
oauth20WrapperController.handleRequest(mockRequest, mockResponse);
((OAuth20WrapperController) oauth20WrapperController)
.getTicketRegistry().deleteTicket(CODE);
assertEquals("text/plain", mockResponse.getContentType());
assertEquals(200, mockResponse.getStatus());
final String body = mockResponse.getContentAsString();
assertTrue(body.contains(OAuthConstants.ACCESS_TOKEN + '='));
assertTrue(body.contains(OAuthConstants.EXPIRES_IN + '='));
// delta = 2 seconds
final int delta = 2;
final int timeLeft = Integer.parseInt(StringUtils.substringAfter(body, '&' + OAuthConstants.EXPIRES_IN + '='));
assertTrue(timeLeft >= TIMEOUT - 10 - delta);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:53,代码来源:OAuth20AccessTokenControllerTests.java
示例16: initialize
import org.jasig.cas.ticket.ServiceTicketImpl; //导入依赖的package包/类
/**
* Initialize and register classes with kryo.
*/
public void initialize() {
// Register types we know about and do not require external configuration
kryo.register(ArrayList.class);
kryo.register(BasicCredentialMetaData.class);
kryo.register(Class.class, new DefaultSerializers.ClassSerializer());
kryo.register(Date.class, new DefaultSerializers.DateSerializer());
kryo.register(HardTimeoutExpirationPolicy.class);
kryo.register(HashMap.class);
kryo.register(LinkedHashMap.class);
kryo.register(HashSet.class);
kryo.register(DefaultHandlerResult.class);
kryo.register(ImmutableAuthentication.class);
kryo.register(MultiTimeUseOrTimeoutExpirationPolicy.class);
kryo.register(NeverExpiresExpirationPolicy.class);
kryo.register(RememberMeDelegatingExpirationPolicy.class);
kryo.register(ServiceTicketImpl.class);
kryo.register(SimpleWebApplicationServiceImpl.class, new SimpleWebApplicationServiceSerializer());
kryo.register(ThrottledUseAndTimeoutExpirationPolicy.class);
kryo.register(TicketGrantingTicketExpirationPolicy.class);
kryo.register(TicketGrantingTicketImpl.class);
kryo.register(TimeoutExpirationPolicy.class);
kryo.register(UsernamePasswordCredential.class);
kryo.register(SimplePrincipal.class);
kryo.register(URL.class, new URLSerializer());
kryo.register(URI.class, new URISerializer());
kryo.register(Pattern.class, new RegexSerializer());
kryo.register(UUID.class, new UUIDSerializer());
kryo.register(EnumMap.class, new EnumMapSerializer());
kryo.register(EnumSet.class, new EnumSetSerializer());
// we add these ones for tests only
kryo.register(RegisteredServiceImpl.class, new RegisteredServiceSerializer());
kryo.register(RegexRegisteredService.class, new RegisteredServiceSerializer());
// new serializers to manage Joda dates and immutable collections
kryo.register(DateTime.class, new JodaDateTimeSerializer());
kryo.register(CasDelegatingLogger.class, new DefaultSerializers.VoidSerializer());
// from the kryo-serializers library (https://github.com/magro/kryo-serializers)
UnmodifiableCollectionsSerializer.registerSerializers(kryo);
ImmutableListSerializer.registerSerializers(kryo);
ImmutableSetSerializer.registerSerializers(kryo);
ImmutableMapSerializer.registerSerializers(kryo);
ImmutableMultimapSerializer.registerSerializers(kryo);
kryo.register(Collections.EMPTY_LIST.getClass(), new CollectionsEmptyListSerializer());
kryo.register(Collections.EMPTY_MAP.getClass(), new CollectionsEmptyMapSerializer());
kryo.register(Collections.EMPTY_SET.getClass(), new CollectionsEmptySetSerializer());
// Register other types
if (serializerMap != null) {
for (final Map.Entry<Class<?>, Serializer> clazz : serializerMap.entrySet()) {
kryo.register(clazz.getKey(), clazz.getValue());
}
}
// don't reinit the registered classes after every write or read
kryo.setAutoReset(false);
// don't replace objects by references
kryo.setReferences(false);
// Catchall for any classes not explicitly registered
kryo.setRegistrationRequired(false);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:67,代码来源:KryoTranscoder.java
示例17: initialize
import org.jasig.cas.ticket.ServiceTicketImpl; //导入依赖的package包/类
/**
* Initialize and register classes with kryo.
*/
public void initialize() {
// Register types we know about and do not require external configuration
kryo.register(ArrayList.class);
kryo.register(BasicCredentialMetaData.class);
kryo.register(Class.class, new DefaultSerializers.ClassSerializer());
kryo.register(Date.class, new DefaultSerializers.DateSerializer());
kryo.register(HardTimeoutExpirationPolicy.class);
kryo.register(HashMap.class);
kryo.register(DefaultHandlerResult.class);
kryo.register(ImmutableAuthentication.class);
kryo.register(MultiTimeUseOrTimeoutExpirationPolicy.class);
kryo.register(NeverExpiresExpirationPolicy.class);
kryo.register(RememberMeDelegatingExpirationPolicy.class);
kryo.register(ServiceTicketImpl.class);
kryo.register(SimpleWebApplicationServiceImpl.class, new SimpleWebApplicationServiceSerializer());
kryo.register(ThrottledUseAndTimeoutExpirationPolicy.class);
kryo.register(TicketGrantingTicketExpirationPolicy.class);
kryo.register(TicketGrantingTicketImpl.class);
kryo.register(TimeoutExpirationPolicy.class);
kryo.register(URL.class, new URLSerializer());
// we add these ones for tests only
kryo.register(RegisteredServiceImpl.class, new RegisteredServiceSerializer());
kryo.register(RegexRegisteredService.class, new RegisteredServiceSerializer());
// new serializers to manage Joda dates and immutable collections
kryo.register(DateTime.class, new JodaDateTimeSerializer());
kryo.register(CasDelegatingLogger.class, new DefaultSerializers.VoidSerializer());
// from the kryo-serializers library (https://github.com/magro/kryo-serializers)
UnmodifiableCollectionsSerializer.registerSerializers(kryo);
// Register other types
if (serializerMap != null) {
for (final Map.Entry<Class<?>, Serializer> clazz : serializerMap.entrySet()) {
kryo.register(clazz.getKey(), clazz.getValue());
}
}
// don't reinit the registered classes after every write or read
kryo.setAutoReset(false);
// don't replace objects by references
kryo.setReferences(false);
// Catchall for any classes not explicitly registered
kryo.setRegistrationRequired(false);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:50,代码来源:KryoTranscoder.java
示例18: initialize
import org.jasig.cas.ticket.ServiceTicketImpl; //导入依赖的package包/类
/**
* Initialize and register classes with kryo.
*/
public void initialize() {
// Register types we know about and do not require external configuration
kryo.register(ArrayList.class);
kryo.register(BasicCredentialMetaData.class);
kryo.register(Class.class, new DefaultSerializers.ClassSerializer());
kryo.register(Date.class, new DefaultSerializers.DateSerializer());
kryo.register(HardTimeoutExpirationPolicy.class);
kryo.register(HashMap.class);
kryo.register(HandlerResult.class);
kryo.register(ImmutableAuthentication.class);
kryo.register(MultiTimeUseOrTimeoutExpirationPolicy.class);
kryo.register(NeverExpiresExpirationPolicy.class);
kryo.register(RememberMeDelegatingExpirationPolicy.class);
kryo.register(ServiceTicketImpl.class);
kryo.register(SimpleWebApplicationServiceImpl.class, new SimpleWebApplicationServiceSerializer());
kryo.register(ThrottledUseAndTimeoutExpirationPolicy.class);
kryo.register(TicketGrantingTicketExpirationPolicy.class);
kryo.register(TicketGrantingTicketImpl.class);
kryo.register(TimeoutExpirationPolicy.class);
kryo.register(URL.class, new URLSerializer());
// we add these ones for tests only
kryo.register(RegisteredServiceImpl.class, new RegisteredServiceSerializer());
kryo.register(RegexRegisteredService.class, new RegisteredServiceSerializer());
// new serializers to manage Joda dates and immutable collections
kryo.register(DateTime.class, new JodaDateTimeSerializer());
// from the kryo-serializers library (https://github.com/magro/kryo-serializers)
UnmodifiableCollectionsSerializer.registerSerializers(kryo);
// Register other types
if (serializerMap != null) {
for (final Map.Entry<Class<?>, Serializer> clazz : serializerMap.entrySet()) {
kryo.register(clazz.getKey(), clazz.getValue());
}
}
// don't reinit the registered classes after every write or read
kryo.setAutoReset(false);
// don't replace objects by references
kryo.setReferences(false);
// Catchall for any classes not explicitly registered
kryo.setRegistrationRequired(false);
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:48,代码来源:KryoTranscoder.java
示例19: verifyOK
import org.jasig.cas.ticket.ServiceTicketImpl; //导入依赖的package包/类
@Test
public void verifyOK() throws Exception {
final MockHttpServletRequest mockRequest = new MockHttpServletRequest("GET", CONTEXT
+ OAuthConstants.ACCESS_TOKEN_URL);
mockRequest.setParameter(OAuthConstants.CLIENT_ID, CLIENT_ID);
mockRequest.setParameter(OAuthConstants.REDIRECT_URI, REDIRECT_URI);
mockRequest.setParameter(OAuthConstants.CLIENT_SECRET, CLIENT_SECRET);
mockRequest.setParameter(OAuthConstants.CODE, CODE);
final MockHttpServletResponse mockResponse = new MockHttpServletResponse();
((OAuth20WrapperController) oauth20WrapperController)
.getServicesManager().save(getRegisteredService(REDIRECT_URI, CLIENT_SECRET));
final Map<String, Object> map = new HashMap<>();
map.put(NAME, VALUE);
final List<String> list = Arrays.asList(VALUE, VALUE);
map.put(NAME2, list);
final Principal p = org.jasig.cas.authentication.TestUtils.getPrincipal(ID, map);
final TicketGrantingTicketImpl impl = new TicketGrantingTicketImpl(TGT_ID,
org.jasig.cas.authentication.TestUtils.getAuthentication(p), new NeverExpiresExpirationPolicy());
((OAuth20WrapperController) oauth20WrapperController)
.getTicketRegistry().addTicket(new ServiceTicketImpl(CODE, impl,
org.jasig.cas.authentication.TestUtils.getService(), false,
new ExpirationPolicy() {
private static final long serialVersionUID = -7321055962209199811L;
@Override
public boolean isExpired(final TicketState ticketState) {
return false;
}
}));
oauth20WrapperController.handleRequest(mockRequest, mockResponse);
((OAuth20WrapperController) oauth20WrapperController)
.getTicketRegistry().deleteTicket(CODE);
assertEquals("text/plain", mockResponse.getContentType());
assertEquals(200, mockResponse.getStatus());
final String body = mockResponse.getContentAsString();
assertTrue(body.contains(OAuthConstants.ACCESS_TOKEN + '='));
assertTrue(body.contains(OAuthConstants.EXPIRES + '='));
// delta = 2 seconds
final int delta = 2;
final int timeLeft = Integer.parseInt(StringUtils.substringAfter(body, '&' + OAuthConstants.EXPIRES + '='));
assertTrue(timeLeft >= TIMEOUT - 10 - delta);
}
开发者ID:yuweijun,项目名称:cas-server-4.2.1,代码行数:53,代码来源:OAuth20AccessTokenControllerTests.java
示例20: deleteServiceTickets
import org.jasig.cas.ticket.ServiceTicketImpl; //导入依赖的package包/类
/**
* Delete service tickets int.
*
* @param ticketId the ticket id
* @return the int
*/
public int deleteServiceTickets(final String ticketId) {
final List<ServiceTicketImpl> serviceTicketImpls = getTicketQueryResultList(ticketId,
"select s from " + TABLE_SERVICE_TICKETS + " s where s.id = :id", ServiceTicketImpl.class);
return deleteTicketsFromResultList(serviceTicketImpls);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:12,代码来源:JpaTicketRegistry.java
注:本文中的org.jasig.cas.ticket.ServiceTicketImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论