本文整理汇总了Java中org.jasig.cas.mock.MockTicketGrantingTicket类的典型用法代码示例。如果您正苦于以下问题:Java MockTicketGrantingTicket类的具体用法?Java MockTicketGrantingTicket怎么用?Java MockTicketGrantingTicket使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MockTicketGrantingTicket类属于org.jasig.cas.mock包,在下文中一共展示了MockTicketGrantingTicket类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: verifyLogoutUrlForServiceIsUsed
import org.jasig.cas.mock.MockTicketGrantingTicket; //导入依赖的package包/类
@Test
public void verifyLogoutUrlForServiceIsUsed() throws Exception {
final RegisteredService svc = getRegisteredService();
when(this.servicesManager.findServiceBy(any(SingleLogoutService.class))).thenReturn(svc);
final SingleLogoutService service = mock(SingleLogoutService.class);
when(service.getId()).thenReturn(svc.getServiceId());
when(service.getOriginalUrl()).thenReturn(svc.getServiceId());
final MockTicketGrantingTicket tgt = new MockTicketGrantingTicket("test");
tgt.getServices().put("service", service);
final Event event = getLogoutEvent(this.logoutManager.performLogout(tgt));
assertEquals(FrontChannelLogoutAction.REDIRECT_APP_EVENT, event.getId());
final List<LogoutRequest> list = WebUtils.getLogoutRequests(this.requestContext);
assertEquals(1, list.size());
final String url = (String) event.getAttributes().get(FrontChannelLogoutAction.DEFAULT_FLOW_ATTRIBUTE_LOGOUT_URL);
assertTrue(url.startsWith(svc.getLogoutUrl().toExternalForm()));
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:20,代码来源:FrontChannelLogoutActionTests.java
示例2: verifyInvalidTicket
import org.jasig.cas.mock.MockTicketGrantingTicket; //导入依赖的package包/类
@Test
public void verifyInvalidTicket() throws Exception {
final MockRequestContext ctx = new MockRequestContext();
final MockTicketGrantingTicket tgt = new MockTicketGrantingTicket("user");
WebUtils.putTicketGrantingTicketInScopes(ctx, tgt);
final TicketGrantingTicketCheckAction action = new
TicketGrantingTicketCheckAction(this.getCentralAuthenticationService());
final Event event = action.doExecute(ctx);
assertEquals(event.getId(), TicketGrantingTicketCheckAction.INVALID);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:13,代码来源:TicketGrantingTicketCheckActionTests.java
示例3: KryoTranscoderTests
import org.jasig.cas.mock.MockTicketGrantingTicket; //导入依赖的package包/类
public KryoTranscoderTests() {
transcoder = new KryoTranscoder();
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));
transcoder.setSerializerMap(serializerMap);
transcoder.initialize();
this.principalAttributes = new HashMap<>();
this.principalAttributes.put(NICKNAME_KEY, NICKNAME_VALUE);
}
示例4: verifyEncodeDecode
import org.jasig.cas.mock.MockTicketGrantingTicket; //导入依赖的package包/类
@Test
public void verifyEncodeDecode() throws Exception {
final TicketGrantingTicket tgt = new MockTicketGrantingTicket(USERNAME);
final ServiceTicket expectedST = new MockServiceTicket(ST_ID, TestUtils.getService(), tgt);
assertEquals(expectedST, transcoder.decode(transcoder.encode(expectedST)));
final Credential userPassCredential = new UsernamePasswordCredential(USERNAME, PASSWORD);
final TicketGrantingTicket expectedTGT = new MockTicketGrantingTicket(USERNAME);
expectedTGT.grantServiceTicket(ST_ID, null, null, false, true);
assertEquals(expectedTGT, transcoder.decode(transcoder.encode(expectedTGT)));
internalProxyTest("http://localhost");
internalProxyTest("https://localhost:8080/path/file.html?p1=v1&p2=v2#fragment");
}
示例5: verifyEncodeDecodeTGTWithUnmodifiableMap
import org.jasig.cas.mock.MockTicketGrantingTicket; //导入依赖的package包/类
@Test
public void verifyEncodeDecodeTGTWithUnmodifiableMap() throws Exception {
final Credential userPassCredential = new UsernamePasswordCredential(USERNAME, PASSWORD);
final TicketGrantingTicket expectedTGT =
new MockTicketGrantingTicket(TGT_ID, userPassCredential, Collections.unmodifiableMap(this.principalAttributes));
expectedTGT.grantServiceTicket(ST_ID, null, null, false, true);
assertEquals(expectedTGT, transcoder.decode(transcoder.encode(expectedTGT)));
}
示例6: verifyEncodeDecodeTGTWithUnmodifiableList
import org.jasig.cas.mock.MockTicketGrantingTicket; //导入依赖的package包/类
@Test
public void verifyEncodeDecodeTGTWithUnmodifiableList() throws Exception {
final Credential userPassCredential = new UsernamePasswordCredential(USERNAME, PASSWORD);
final List<String> values = new ArrayList<>();
values.add(NICKNAME_VALUE);
final Map<String, Object> newAttributes = new HashMap<>();
newAttributes.put(NICKNAME_KEY, Collections.unmodifiableList(values));
final TicketGrantingTicket expectedTGT = new MockTicketGrantingTicket(TGT_ID, userPassCredential, newAttributes);
expectedTGT.grantServiceTicket(ST_ID, null, null, false, true);
assertEquals(expectedTGT, transcoder.decode(transcoder.encode(expectedTGT)));
}
示例7: verifyEncodeDecodeTGTWithLinkedHashMap
import org.jasig.cas.mock.MockTicketGrantingTicket; //导入依赖的package包/类
@Test
public void verifyEncodeDecodeTGTWithLinkedHashMap() throws Exception {
final Credential userPassCredential = new UsernamePasswordCredential(USERNAME, PASSWORD);
final TicketGrantingTicket expectedTGT =
new MockTicketGrantingTicket(TGT_ID, userPassCredential, new LinkedHashMap<String, Object>(this.principalAttributes));
expectedTGT.grantServiceTicket(ST_ID, null, null, false, true);
assertEquals(expectedTGT, transcoder.decode(transcoder.encode(expectedTGT)));
}
示例8: verifyEncodeDecodeTGTWithListOrderedMap
import org.jasig.cas.mock.MockTicketGrantingTicket; //导入依赖的package包/类
@Test
public void verifyEncodeDecodeTGTWithListOrderedMap() throws Exception {
final Credential userPassCredential = new UsernamePasswordCredential(USERNAME, PASSWORD);
@SuppressWarnings("unchecked")
final TicketGrantingTicket expectedTGT =
new MockTicketGrantingTicket(TGT_ID, userPassCredential, this.principalAttributes);
expectedTGT.grantServiceTicket(ST_ID, null, null, false, true);
assertEquals(expectedTGT, transcoder.decode(transcoder.encode(expectedTGT)));
}
示例9: verifyEncodeDecodeTGTWithUnmodifiableSet
import org.jasig.cas.mock.MockTicketGrantingTicket; //导入依赖的package包/类
@Test
public void verifyEncodeDecodeTGTWithUnmodifiableSet() throws Exception {
final Map<String, Object> newAttributes = new HashMap<>();
final Set<String> values = new HashSet<>();
values.add(NICKNAME_VALUE);
newAttributes.put(NICKNAME_KEY, Collections.unmodifiableSet(values));
final Credential userPassCredential = new UsernamePasswordCredential(USERNAME, PASSWORD);
final TicketGrantingTicket expectedTGT = new MockTicketGrantingTicket(TGT_ID, userPassCredential, newAttributes);
expectedTGT.grantServiceTicket(ST_ID, null, null, false, true);
assertEquals(expectedTGT, transcoder.decode(transcoder.encode(expectedTGT)));
}
示例10: verifyEncodeDecodeTGTWithSingleton
import org.jasig.cas.mock.MockTicketGrantingTicket; //导入依赖的package包/类
@Test
public void verifyEncodeDecodeTGTWithSingleton() throws Exception {
final Map<String, Object> newAttributes = new HashMap<>();
newAttributes.put(NICKNAME_KEY, Collections.singleton(NICKNAME_VALUE));
final Credential userPassCredential = new UsernamePasswordCredential(USERNAME, PASSWORD);
final TicketGrantingTicket expectedTGT = new MockTicketGrantingTicket(TGT_ID, userPassCredential, newAttributes);
expectedTGT.grantServiceTicket(ST_ID, null, null, false, true);
assertEquals(expectedTGT, transcoder.decode(transcoder.encode(expectedTGT)));
}
示例11: verifyEncodeDecodeTGTWithSingletonMap
import org.jasig.cas.mock.MockTicketGrantingTicket; //导入依赖的package包/类
@Test
public void verifyEncodeDecodeTGTWithSingletonMap() throws Exception {
final Map<String, Object> newAttributes = Collections.singletonMap(NICKNAME_KEY, (Object) NICKNAME_VALUE);
final Credential userPassCredential = new UsernamePasswordCredential(USERNAME, PASSWORD);
final TicketGrantingTicket expectedTGT = new MockTicketGrantingTicket(TGT_ID, userPassCredential, newAttributes);
expectedTGT.grantServiceTicket(ST_ID, null, null, false, true);
assertEquals(expectedTGT, transcoder.decode(transcoder.encode(expectedTGT)));
}
示例12: newTestTgt
import org.jasig.cas.mock.MockTicketGrantingTicket; //导入依赖的package包/类
private TicketGrantingTicket newTestTgt() {
return new MockTicketGrantingTicket("casuser");
}
示例13: internalProxyTest
import org.jasig.cas.mock.MockTicketGrantingTicket; //导入依赖的package包/类
private void internalProxyTest(final String proxyUrl) throws MalformedURLException {
final Credential proxyCredential = new HttpBasedServiceCredential(new URL(proxyUrl), TestUtils.getRegisteredService("https://.+"));
final TicketGrantingTicket expectedTGT = new MockTicketGrantingTicket(USERNAME);
expectedTGT.grantServiceTicket(ST_ID, null, null, false, true);
assertEquals(expectedTGT, transcoder.decode(transcoder.encode(expectedTGT)));
}