當前位置: 首頁>>代碼示例>>Java>>正文


Java MockTicketGrantingTicket類代碼示例

本文整理匯總了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);
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:16,代碼來源:KryoTranscoderTests.java

示例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");
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:15,代碼來源:KryoTranscoderTests.java

示例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)));
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:9,代碼來源:KryoTranscoderTests.java

示例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)));
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:12,代碼來源:KryoTranscoderTests.java

示例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)));
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:9,代碼來源:KryoTranscoderTests.java

示例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)));
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:10,代碼來源:KryoTranscoderTests.java

示例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)));
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:12,代碼來源:KryoTranscoderTests.java

示例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)));
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:10,代碼來源:KryoTranscoderTests.java

示例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)));
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:9,代碼來源:KryoTranscoderTests.java

示例12: newTestTgt

import org.jasig.cas.mock.MockTicketGrantingTicket; //導入依賴的package包/類
private TicketGrantingTicket newTestTgt() {
    return new MockTicketGrantingTicket("casuser");
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:4,代碼來源:HazelcastTicketRegistryTests.java

示例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)));
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:7,代碼來源:KryoTranscoderTests.java


注:本文中的org.jasig.cas.mock.MockTicketGrantingTicket類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。