List of usage examples for org.springframework.security.cas.authentication CasAuthenticationToken getCredentials
@Override
public Object getCredentials()
From source file:com.vnomicscorp.spring.security.cas.authentication.redis.RedisStatelessTicketCache.java
@Override public void removeTicketFromCache(CasAuthenticationToken token) { removeTicketFromCache(token.getCredentials().toString()); }
From source file:com.vnomicscorp.spring.security.cas.authentication.redis.DefaultCasAuthenticationTokenSerializerTest.java
private void assertTokenEquals(CasAuthenticationToken expected, CasAuthenticationToken got) { assertEquals(expected.getName(), got.getName()); assertEquals(expected.isAuthenticated(), got.isAuthenticated()); assertEquals(expected.getAuthorities(), got.getAuthorities()); assertEquals(expected.getCredentials(), got.getCredentials()); assertEquals(expected.getDetails(), got.getDetails()); assertEquals(expected.getKeyHash(), got.getKeyHash()); assertEquals(expected.getPrincipal(), got.getPrincipal()); assertEquals(expected.getUserDetails(), got.getUserDetails()); }
From source file:com.vnomicscorp.spring.security.cas.authentication.redis.RedisStatelessTicketCache.java
@Override public void putTicketInCache(CasAuthenticationToken token) { if (token == null) { throw new NullPointerException("Expected given token to be not null"); }/*from ww w . jav a2 s .c o m*/ Jedis jedis = null; try { jedis = jedisPool.getResource(); String serialized = casAuthenticationTokenSerializer.serialize(token); String key = token.getCredentials().toString(); logger.debug("Cache put: {}", key); Transaction transaction = jedis.multi(); transaction.set(key, serialized); if (expirationSeconds != -1) { transaction.expire(key, expirationSeconds); } transaction.exec(); } catch (CasAuthenticationTokenSerializerException e) { throw new RuntimeException("Exception encountered while deserializing CasAuthenticationToken", e); } finally { if (jedis != null) { jedis.close(); } } }
From source file:org.jasig.cas.support.pac4j.web.flow.ClientLogoutAction.java
private void logAuthentication(Authentication authentication) { org.jasig.cas.authentication.principal.SimplePrincipal principal = (SimplePrincipal) authentication .getPrincipal();//from w w w. j av a 2 s . c om Map<String, Object> attributes = authentication.getAttributes(); Map<String, Object> pattributes = principal.getAttributes(); for (Map.Entry<String, Object> entry : pattributes.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); System.out.println("p attributes" + key + " a value " + value.getClass()); //CasAuthenticationToken } logger.debug("=========================================="); logger.debug("ClientLogoutAction CAS Authentication: "); logger.debug("principal.getId(): " + principal.getId()); for (Map.Entry<String, Object> entry : attributes.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); logger.debug("authentication.attributes key: " + key + " value: " + value); } for (Map.Entry<String, Object> entry : pattributes.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); logger.debug("principal.attributes key: " + key); if (value instanceof CasAuthenticationToken) { CasAuthenticationToken casAuthenticationToken = (CasAuthenticationToken) value; logger.debug("principal.casAuthenticationToken.getName: " + casAuthenticationToken.getName()); logger.debug("principal.casAuthenticationToken.getName: " + casAuthenticationToken.getCredentials().getClass()); } } logger.debug("=========================================="); }
From source file:org.springframework.security.cas.authentication.EhCacheBasedTicketCache.java
public void putTicketInCache(final CasAuthenticationToken token) { final Element element = new Element(token.getCredentials().toString(), token); if (logger.isDebugEnabled()) { logger.debug("Cache put: " + element.getKey()); }/* w ww . j a v a 2 s. com*/ cache.put(element); }
From source file:org.springframework.security.cas.authentication.EhCacheBasedTicketCache.java
public void removeTicketFromCache(final CasAuthenticationToken token) { if (logger.isDebugEnabled()) { logger.debug("Cache remove: " + token.getCredentials().toString()); }/*from w w w.jav a 2s. c om*/ this.removeTicketFromCache(token.getCredentials().toString()); }
From source file:org.springframework.security.cas.authentication.SpringCacheBasedTicketCache.java
public void putTicketInCache(final CasAuthenticationToken token) { String key = token.getCredentials().toString(); if (logger.isDebugEnabled()) { logger.debug("Cache put: " + key); }//from ww w . ja v a2s . c o m cache.put(key, token); }