本文整理汇总了Java中org.jasig.cas.util.UniqueTicketIdGenerator类的典型用法代码示例。如果您正苦于以下问题:Java UniqueTicketIdGenerator类的具体用法?Java UniqueTicketIdGenerator怎么用?Java UniqueTicketIdGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UniqueTicketIdGenerator类属于org.jasig.cas.util包,在下文中一共展示了UniqueTicketIdGenerator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: CentralAuthenticationServiceImpl
import org.jasig.cas.util.UniqueTicketIdGenerator; //导入依赖的package包/类
/**
* Build the central authentication service implementation.
*
* @param ticketRegistry the tickets registry.
* @param serviceTicketRegistry the service tickets registry.
* @param authenticationManager the authentication manager.
* @param ticketGrantingTicketUniqueTicketIdGenerator the TGT id generator.
* @param uniqueTicketIdGeneratorsForService the map with service and ticket id generators.
* @param ticketGrantingTicketExpirationPolicy the TGT expiration policy.
* @param serviceTicketExpirationPolicy the service ticket expiration policy.
* @param servicesManager the services manager.
* @param logoutManager the logout manager.
*/
public CentralAuthenticationServiceImpl(final TicketRegistry ticketRegistry,
final TicketRegistry serviceTicketRegistry,
final AuthenticationManager authenticationManager,
final UniqueTicketIdGenerator ticketGrantingTicketUniqueTicketIdGenerator,
final Map<String, UniqueTicketIdGenerator> uniqueTicketIdGeneratorsForService,
final ExpirationPolicy ticketGrantingTicketExpirationPolicy,
final ExpirationPolicy serviceTicketExpirationPolicy,
final ServicesManager servicesManager,
final LogoutManager logoutManager) {
this.ticketRegistry = ticketRegistry;
if (serviceTicketRegistry == null) {
this.serviceTicketRegistry = ticketRegistry;
} else {
this.serviceTicketRegistry = serviceTicketRegistry;
}
this.authenticationManager = authenticationManager;
this.ticketGrantingTicketUniqueTicketIdGenerator = ticketGrantingTicketUniqueTicketIdGenerator;
this.uniqueTicketIdGeneratorsForService = uniqueTicketIdGeneratorsForService;
this.ticketGrantingTicketExpirationPolicy = ticketGrantingTicketExpirationPolicy;
this.serviceTicketExpirationPolicy = serviceTicketExpirationPolicy;
this.servicesManager = servicesManager;
this.logoutManager = logoutManager;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:37,代码来源:CentralAuthenticationServiceImpl.java
示例2: setUp
import org.jasig.cas.util.UniqueTicketIdGenerator; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.ticketRegistry = new DefaultTicketRegistry();
final OpenIdCredentialsAuthenticationHandler handler = new OpenIdCredentialsAuthenticationHandler();
handler.setTicketRegistry(this.ticketRegistry);
this.authenticationManager = new PolicyBasedAuthenticationManager(
Collections.<AuthenticationHandler, PrincipalResolver>singletonMap(
handler,
new OpenIdPrincipalResolver()));
final Map<String, UniqueTicketIdGenerator> generator = new HashMap<>();
generator.put(OpenIdService.class.getName(), new DefaultUniqueTicketIdGenerator());
impl = new CentralAuthenticationServiceImpl(this.ticketRegistry, null, this.authenticationManager,
new DefaultUniqueTicketIdGenerator(), generator, new NeverExpiresExpirationPolicy(),
new NeverExpiresExpirationPolicy(),
new DefaultServicesManagerImpl(new InMemoryServiceRegistryDaoImpl()), mock(LogoutManager.class));
this.action = new OpenIdSingleSignOnAction();
this.action.setCentralAuthenticationService(this.impl);
this.action.setExtractor(new DefaultOpenIdUserNameExtractor());
this.action.afterPropertiesSet();
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:24,代码来源:OpenIdSingleSignOnActionTests.java
示例3: setUp
import org.jasig.cas.util.UniqueTicketIdGenerator; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.action = new PrincipalFromRequestRemoteUserNonInteractiveCredentialsAction();
final Map<String, UniqueTicketIdGenerator> idGenerators = new HashMap<>();
idGenerators.put(SimpleWebApplicationServiceImpl.class.getName(), new DefaultUniqueTicketIdGenerator());
final AuthenticationManager authenticationManager = new PolicyBasedAuthenticationManager(
Collections.<AuthenticationHandler, PrincipalResolver>singletonMap(
new PrincipalBearingCredentialsAuthenticationHandler(),
new PrincipalBearingPrincipalResolver()));
final CentralAuthenticationServiceImpl centralAuthenticationService = new CentralAuthenticationServiceImpl(
new DefaultTicketRegistry(), null, authenticationManager, new DefaultUniqueTicketIdGenerator(),
idGenerators, new NeverExpiresExpirationPolicy(), new NeverExpiresExpirationPolicy(),
mock(ServicesManager.class), mock(LogoutManager.class));
this.action.setCentralAuthenticationService(centralAuthenticationService);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:19,代码来源:PrincipalFromRequestRemoteUserNonInteractiveCredentialsActionTests.java
示例4: setUp
import org.jasig.cas.util.UniqueTicketIdGenerator; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.action = new PrincipalFromRequestUserPrincipalNonInteractiveCredentialsAction();
final Map<String, UniqueTicketIdGenerator> idGenerators = new HashMap<>();
idGenerators.put(SimpleWebApplicationServiceImpl.class.getName(), new DefaultUniqueTicketIdGenerator());
final AuthenticationManager authenticationManager = new PolicyBasedAuthenticationManager(
Collections.<AuthenticationHandler, PrincipalResolver>singletonMap(
new PrincipalBearingCredentialsAuthenticationHandler(),
new PrincipalBearingPrincipalResolver()));
final CentralAuthenticationServiceImpl centralAuthenticationService = new CentralAuthenticationServiceImpl(
new DefaultTicketRegistry(), null, authenticationManager, new DefaultUniqueTicketIdGenerator(),
idGenerators, new NeverExpiresExpirationPolicy(), new NeverExpiresExpirationPolicy(),
mock(ServicesManager.class), mock(LogoutManager.class));
this.action.setCentralAuthenticationService(centralAuthenticationService);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:21,代码来源:PrincipalFromRequestUserPrincipalNonInteractiveCredentialsActionTests.java
示例5: setUp
import org.jasig.cas.util.UniqueTicketIdGenerator; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.action = new X509CertificateCredentialsNonInteractiveAction();
final Map<String, UniqueTicketIdGenerator> idGenerators = new HashMap<>();
idGenerators.put(SimpleWebApplicationServiceImpl.class.getName(), new DefaultUniqueTicketIdGenerator());
final X509CredentialsAuthenticationHandler handler = new X509CredentialsAuthenticationHandler();
handler.setTrustedIssuerDnPattern("CN=\\w+,DC=jasig,DC=org");
final AuthenticationManager authenticationManager = new PolicyBasedAuthenticationManager(
Collections.<AuthenticationHandler, PrincipalResolver>singletonMap(
handler, new X509SerialNumberPrincipalResolver()));
final CentralAuthenticationServiceImpl centralAuthenticationService = new CentralAuthenticationServiceImpl(
new DefaultTicketRegistry(), null, authenticationManager, new DefaultUniqueTicketIdGenerator(),
idGenerators, new NeverExpiresExpirationPolicy(), new NeverExpiresExpirationPolicy(),
mock(ServicesManager.class), mock(LogoutManager.class));
this.action.setCentralAuthenticationService(centralAuthenticationService);
this.action.afterPropertiesSet();
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:23,代码来源:X509CertificateCredentialsNonInteractiveActionTests.java
示例6: setUp
import org.jasig.cas.util.UniqueTicketIdGenerator; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.ticketRegistry = new DefaultTicketRegistry();
final OpenIdCredentialsAuthenticationHandler handler = new OpenIdCredentialsAuthenticationHandler();
handler.setTicketRegistry(this.ticketRegistry);
this.authenticationManager = new PolicyBasedAuthenticationManager(
Collections.<AuthenticationHandler, PrincipalResolver>singletonMap(
handler,
new OpenIdPrincipalResolver()));
final Map<String, UniqueTicketIdGenerator> generator = new HashMap<String, UniqueTicketIdGenerator>();
generator.put(OpenIdService.class.getName(), new DefaultUniqueTicketIdGenerator());
impl = new CentralAuthenticationServiceImpl(this.ticketRegistry, null, this.authenticationManager,
new DefaultUniqueTicketIdGenerator(), generator, new NeverExpiresExpirationPolicy(),
new NeverExpiresExpirationPolicy(),
new DefaultServicesManagerImpl(new InMemoryServiceRegistryDaoImpl()), mock(LogoutManager.class));
this.action = new OpenIdSingleSignOnAction();
this.action.setCentralAuthenticationService(this.impl);
this.action.setExtractor(new DefaultOpenIdUserNameExtractor());
this.action.afterPropertiesSet();
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:24,代码来源:OpenIdSingleSignOnActionTests.java
示例7: setUp
import org.jasig.cas.util.UniqueTicketIdGenerator; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.action = new PrincipalFromRequestRemoteUserNonInteractiveCredentialsAction();
final Map<String, UniqueTicketIdGenerator> idGenerators = new HashMap<String, UniqueTicketIdGenerator>();
idGenerators.put(SimpleWebApplicationServiceImpl.class.getName(), new DefaultUniqueTicketIdGenerator());
final AuthenticationManager authenticationManager = new PolicyBasedAuthenticationManager(
Collections.<AuthenticationHandler, PrincipalResolver>singletonMap(
new PrincipalBearingCredentialsAuthenticationHandler(),
new PrincipalBearingPrincipalResolver()));
final CentralAuthenticationServiceImpl centralAuthenticationService = new CentralAuthenticationServiceImpl(
new DefaultTicketRegistry(), null, authenticationManager, new DefaultUniqueTicketIdGenerator(),
idGenerators, new NeverExpiresExpirationPolicy(), new NeverExpiresExpirationPolicy(),
mock(ServicesManager.class), mock(LogoutManager.class));
this.action.setCentralAuthenticationService(centralAuthenticationService);
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:19,代码来源:PrincipalFromRequestRemoteUserNonInteractiveCredentialsActionTests.java
示例8: setUp
import org.jasig.cas.util.UniqueTicketIdGenerator; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.action = new PrincipalFromRequestUserPrincipalNonInteractiveCredentialsAction();
final Map<String, UniqueTicketIdGenerator> idGenerators = new HashMap<String, UniqueTicketIdGenerator>();
idGenerators.put(SimpleWebApplicationServiceImpl.class.getName(), new DefaultUniqueTicketIdGenerator());
final AuthenticationManager authenticationManager = new PolicyBasedAuthenticationManager(
Collections.<AuthenticationHandler, PrincipalResolver>singletonMap(
new PrincipalBearingCredentialsAuthenticationHandler(),
new PrincipalBearingPrincipalResolver()));
final CentralAuthenticationServiceImpl centralAuthenticationService = new CentralAuthenticationServiceImpl(
new DefaultTicketRegistry(), null, authenticationManager, new DefaultUniqueTicketIdGenerator(),
idGenerators, new NeverExpiresExpirationPolicy(), new NeverExpiresExpirationPolicy(),
mock(ServicesManager.class), mock(LogoutManager.class));
this.action.setCentralAuthenticationService(centralAuthenticationService);
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:21,代码来源:PrincipalFromRequestUserPrincipalNonInteractiveCredentialsActionTests.java
示例9: setUp
import org.jasig.cas.util.UniqueTicketIdGenerator; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.action = new X509CertificateCredentialsNonInteractiveAction();
final Map<String, UniqueTicketIdGenerator> idGenerators = new HashMap<String, UniqueTicketIdGenerator>();
idGenerators.put(SimpleWebApplicationServiceImpl.class.getName(), new DefaultUniqueTicketIdGenerator());
final X509CredentialsAuthenticationHandler handler = new X509CredentialsAuthenticationHandler();
handler.setTrustedIssuerDnPattern("CN=\\w+,DC=jasig,DC=org");
final AuthenticationManager authenticationManager = new PolicyBasedAuthenticationManager(
Collections.<AuthenticationHandler, PrincipalResolver>singletonMap(
handler, new X509SerialNumberPrincipalResolver()));
final CentralAuthenticationServiceImpl centralAuthenticationService = new CentralAuthenticationServiceImpl(
new DefaultTicketRegistry(), null, authenticationManager, new DefaultUniqueTicketIdGenerator(),
idGenerators, new NeverExpiresExpirationPolicy(), new NeverExpiresExpirationPolicy(),
mock(ServicesManager.class), mock(LogoutManager.class));
this.action.setCentralAuthenticationService(centralAuthenticationService);
this.action.afterPropertiesSet();
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:23,代码来源:X509CertificateCredentialsNonInteractiveActionTests.java
示例10: CentralAuthenticationServiceImpl
import org.jasig.cas.util.UniqueTicketIdGenerator; //导入依赖的package包/类
/**
* Build the central authentication service implementation.
*
* @param ticketRegistry the tickets registry.
* @param authenticationManager the authentication manager.
* @param ticketGrantingTicketUniqueTicketIdGenerator the TGT id generator.
* @param uniqueTicketIdGeneratorsForService the map with service and ticket id generators.
* @param ticketGrantingTicketExpirationPolicy the TGT expiration policy.
* @param serviceTicketExpirationPolicy the service ticket expiration policy.
* @param servicesManager the services manager.
* @param logoutManager the logout manager.
*/
public CentralAuthenticationServiceImpl(final TicketRegistry ticketRegistry,
final AuthenticationManager authenticationManager,
final UniqueTicketIdGenerator ticketGrantingTicketUniqueTicketIdGenerator,
final Map<String, UniqueTicketIdGenerator> uniqueTicketIdGeneratorsForService,
final ExpirationPolicy ticketGrantingTicketExpirationPolicy,
final ExpirationPolicy serviceTicketExpirationPolicy,
final ServicesManager servicesManager,
final LogoutManager logoutManager) {
this.ticketRegistry = ticketRegistry;
this.authenticationManager = authenticationManager;
this.ticketGrantingTicketUniqueTicketIdGenerator = ticketGrantingTicketUniqueTicketIdGenerator;
this.uniqueTicketIdGeneratorsForService = uniqueTicketIdGeneratorsForService;
this.ticketGrantingTicketExpirationPolicy = ticketGrantingTicketExpirationPolicy;
this.serviceTicketExpirationPolicy = serviceTicketExpirationPolicy;
this.servicesManager = servicesManager;
this.logoutManager = logoutManager;
}
开发者ID:xuchengdong,项目名称:cas4.1.9,代码行数:30,代码来源:CentralAuthenticationServiceImpl.java
示例11: setUp
import org.jasig.cas.util.UniqueTicketIdGenerator; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.ticketRegistry = new DefaultTicketRegistry();
final OpenIdCredentialsAuthenticationHandler handler = new OpenIdCredentialsAuthenticationHandler();
handler.setTicketRegistry(this.ticketRegistry);
this.authenticationManager = new PolicyBasedAuthenticationManager(
Collections.<AuthenticationHandler, PrincipalResolver>singletonMap(
handler,
new OpenIdPrincipalResolver()));
final Map<String, UniqueTicketIdGenerator> generator = new HashMap<>();
generator.put(OpenIdService.class.getName(), new DefaultUniqueTicketIdGenerator());
impl = new CentralAuthenticationServiceImpl(this.ticketRegistry, this.authenticationManager,
new DefaultUniqueTicketIdGenerator(), generator, new NeverExpiresExpirationPolicy(),
new NeverExpiresExpirationPolicy(),
new DefaultServicesManagerImpl(new InMemoryServiceRegistryDaoImpl()), mock(LogoutManager.class));
this.action = new OpenIdSingleSignOnAction();
this.action.setCentralAuthenticationService(this.impl);
this.action.setExtractor(new DefaultOpenIdUserNameExtractor());
this.action.afterPropertiesSet();
}
开发者ID:xuchengdong,项目名称:cas4.1.9,代码行数:24,代码来源:OpenIdSingleSignOnActionTests.java
示例12: setUp
import org.jasig.cas.util.UniqueTicketIdGenerator; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.action = new PrincipalFromRequestRemoteUserNonInteractiveCredentialsAction();
final Map<String, UniqueTicketIdGenerator> idGenerators = new HashMap<>();
idGenerators.put(SimpleWebApplicationServiceImpl.class.getName(), new DefaultUniqueTicketIdGenerator());
final AuthenticationManager authenticationManager = new PolicyBasedAuthenticationManager(
Collections.<AuthenticationHandler, PrincipalResolver>singletonMap(
new PrincipalBearingCredentialsAuthenticationHandler(),
new PrincipalBearingPrincipalResolver()));
final CentralAuthenticationServiceImpl centralAuthenticationService = new CentralAuthenticationServiceImpl(
new DefaultTicketRegistry(), authenticationManager, new DefaultUniqueTicketIdGenerator(),
idGenerators, new NeverExpiresExpirationPolicy(), new NeverExpiresExpirationPolicy(),
mock(ServicesManager.class), mock(LogoutManager.class));
this.action.setCentralAuthenticationService(centralAuthenticationService);
}
开发者ID:xuchengdong,项目名称:cas4.1.9,代码行数:19,代码来源:PrincipalFromRequestRemoteUserNonInteractiveCredentialsActionTests.java
示例13: setUp
import org.jasig.cas.util.UniqueTicketIdGenerator; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.action = new PrincipalFromRequestUserPrincipalNonInteractiveCredentialsAction();
final Map<String, UniqueTicketIdGenerator> idGenerators = new HashMap<>();
idGenerators.put(SimpleWebApplicationServiceImpl.class.getName(), new DefaultUniqueTicketIdGenerator());
final AuthenticationManager authenticationManager = new PolicyBasedAuthenticationManager(
Collections.<AuthenticationHandler, PrincipalResolver>singletonMap(
new PrincipalBearingCredentialsAuthenticationHandler(),
new PrincipalBearingPrincipalResolver()));
final CentralAuthenticationServiceImpl centralAuthenticationService = new CentralAuthenticationServiceImpl(
new DefaultTicketRegistry(), authenticationManager, new DefaultUniqueTicketIdGenerator(),
idGenerators, new NeverExpiresExpirationPolicy(), new NeverExpiresExpirationPolicy(),
mock(ServicesManager.class), mock(LogoutManager.class));
this.action.setCentralAuthenticationService(centralAuthenticationService);
}
开发者ID:xuchengdong,项目名称:cas4.1.9,代码行数:21,代码来源:PrincipalFromRequestUserPrincipalNonInteractiveCredentialsActionTests.java
示例14: setUp
import org.jasig.cas.util.UniqueTicketIdGenerator; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.action = new X509CertificateCredentialsNonInteractiveAction();
final Map<String, UniqueTicketIdGenerator> idGenerators = new HashMap<>();
idGenerators.put(SimpleWebApplicationServiceImpl.class.getName(), new DefaultUniqueTicketIdGenerator());
final X509CredentialsAuthenticationHandler handler = new X509CredentialsAuthenticationHandler();
handler.setTrustedIssuerDnPattern("CN=\\w+,DC=jasig,DC=org");
final AuthenticationManager authenticationManager = new PolicyBasedAuthenticationManager(
Collections.<AuthenticationHandler, PrincipalResolver>singletonMap(
handler, new X509SerialNumberPrincipalResolver()));
final CentralAuthenticationServiceImpl centralAuthenticationService = new CentralAuthenticationServiceImpl(
new DefaultTicketRegistry(), authenticationManager, new DefaultUniqueTicketIdGenerator(),
idGenerators, new NeverExpiresExpirationPolicy(), new NeverExpiresExpirationPolicy(),
mock(ServicesManager.class), mock(LogoutManager.class));
this.action.setCentralAuthenticationService(centralAuthenticationService);
this.action.afterPropertiesSet();
}
开发者ID:xuchengdong,项目名称:cas4.1.9,代码行数:23,代码来源:X509CertificateCredentialsNonInteractiveActionTests.java
示例15: getNewRegistryCleaner
import org.jasig.cas.util.UniqueTicketIdGenerator; //导入依赖的package包/类
@Override
public RegistryCleaner getNewRegistryCleaner(final TicketRegistry ticketRegistry) {
this.centralAuthenticationService = new CentralAuthenticationServiceImpl(this.ticketRegistry, this.ticketRegistry,
mock(AuthenticationManager.class), mock(UniqueTicketIdGenerator.class), Collections.EMPTY_MAP,
new NeverExpiresExpirationPolicy(), new NeverExpiresExpirationPolicy(), mock(ServicesManager.class),
mock(LogoutManager.class));
return new DefaultTicketRegistryCleaner(this.centralAuthenticationService, this.ticketRegistry);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:10,代码来源:DefaultTicketRegistryCleanerTests.java
示例16: getNewRegistryCleaner
import org.jasig.cas.util.UniqueTicketIdGenerator; //导入依赖的package包/类
@Override
public RegistryCleaner getNewRegistryCleaner(final TicketRegistry ticketRegistry) {
this.centralAuthenticationService = new CentralAuthenticationServiceImpl(this.ticketRegistry,
mock(AuthenticationManager.class), mock(UniqueTicketIdGenerator.class), Collections.EMPTY_MAP,
new NeverExpiresExpirationPolicy(), new NeverExpiresExpirationPolicy(), mock(ServicesManager.class),
mock(LogoutManager.class));
return new DefaultTicketRegistryCleaner(this.centralAuthenticationService, this.ticketRegistry);
}
开发者ID:xuchengdong,项目名称:cas4.1.9,代码行数:10,代码来源:DefaultTicketRegistryCleanerTests.java
示例17: setUniqueTicketIdGenerator
import org.jasig.cas.util.UniqueTicketIdGenerator; //导入依赖的package包/类
/**
* @param uniqueTicketIdGenerator The uniqueTicketIdGenerator to set.
*/
public void setUniqueTicketIdGenerator(final UniqueTicketIdGenerator uniqueTicketIdGenerator) {
this.uniqueTicketIdGenerator = uniqueTicketIdGenerator;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:7,代码来源:Cas20ProxyHandler.java
示例18: prepareNewCAS
import org.jasig.cas.util.UniqueTicketIdGenerator; //导入依赖的package包/类
@Before
public void prepareNewCAS() {
this.authentication = mock(Authentication.class);
when(this.authentication.getAuthenticationDate()).thenReturn(new Date());
final CredentialMetaData metadata = new BasicCredentialMetaData(TestUtils.getCredentialsWithSameUsernameAndPassword("principal"));
final Map<String, HandlerResult> successes = new HashMap<>();
successes.put("handler1", new DefaultHandlerResult(mock(AuthenticationHandler.class), metadata));
when(this.authentication.getCredentials()).thenReturn(Arrays.asList(metadata));
when(this.authentication.getSuccesses()).thenReturn(successes);
when(this.authentication.getPrincipal()).thenReturn(new DefaultPrincipalFactory().createPrincipal(PRINCIPAL));
final Service service1 = TestUtils.getService(SVC1_ID);
final ServiceTicket stMock = createMockServiceTicket(ST_ID, service1);
final TicketGrantingTicket tgtRootMock = createRootTicketGrantingTicket();
final TicketGrantingTicket tgtMock = createMockTicketGrantingTicket(TGT_ID, stMock, false,
tgtRootMock, new ArrayList<Authentication>());
when(tgtMock.getProxiedBy()).thenReturn(TestUtils.getService("proxiedBy"));
final List<Authentication> authnListMock = mock(List.class);
//Size is required to be 2, so that we can simulate proxying capabilities
when(authnListMock.size()).thenReturn(2);
when(authnListMock.get(anyInt())).thenReturn(this.authentication);
when(tgtMock.getChainedAuthentications()).thenReturn(authnListMock);
when(stMock.getGrantingTicket()).thenReturn(tgtMock);
final Service service2 = TestUtils.getService(SVC2_ID);
final ServiceTicket stMock2 = createMockServiceTicket(ST2_ID, service2);
final TicketGrantingTicket tgtMock2 = createMockTicketGrantingTicket(TGT2_ID, stMock2, false, tgtRootMock, authnListMock);
//Mock TicketRegistry
this.ticketRegMock = mock(TicketRegistry.class);
when(ticketRegMock.getTicket(eq(tgtMock.getId()), eq(TicketGrantingTicket.class))).thenReturn(tgtMock);
when(ticketRegMock.getTicket(eq(tgtMock2.getId()), eq(TicketGrantingTicket.class))).thenReturn(tgtMock2);
when(ticketRegMock.getTicket(eq(stMock.getId()), eq(ServiceTicket.class))).thenReturn(stMock);
when(ticketRegMock.getTicket(eq(stMock2.getId()), eq(ServiceTicket.class))).thenReturn(stMock2);
when(ticketRegMock.getTickets()).thenReturn(Arrays.asList(tgtMock, tgtMock2, stMock, stMock2));
//Mock ServicesManager
final RegisteredService mockRegSvc1 = createMockRegisteredService(service1.getId(), true, getServiceProxyPolicy(false));
final RegisteredService mockRegSvc2 = createMockRegisteredService("test", false, getServiceProxyPolicy(true));
final RegisteredService mockRegSvc3 = createMockRegisteredService(service2.getId(), true, getServiceProxyPolicy(true));
final ServicesManager smMock = mock(ServicesManager.class);
when(smMock.findServiceBy(argThat(new VerifyServiceByIdMatcher(service1.getId())))).thenReturn(mockRegSvc1);
when(smMock.findServiceBy(argThat(new VerifyServiceByIdMatcher("test")))).thenReturn(mockRegSvc2);
when(smMock.findServiceBy(argThat(new VerifyServiceByIdMatcher(service2.getId())))).thenReturn(mockRegSvc3);
final Map ticketIdGenForServiceMock = mock(Map.class);
when(ticketIdGenForServiceMock.containsKey(any())).thenReturn(true);
when(ticketIdGenForServiceMock.get(any())).thenReturn(new DefaultUniqueTicketIdGenerator());
this.cas = new CentralAuthenticationServiceImpl(ticketRegMock, null, mock(AuthenticationManager.class),
mock(UniqueTicketIdGenerator.class), ticketIdGenForServiceMock, mock(ExpirationPolicy.class),
mock(ExpirationPolicy.class), smMock, mock(LogoutManager.class));
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:59,代码来源:CentralAuthenticationServiceImplWithMockitoTests.java
示例19: setTicketIdGenerator
import org.jasig.cas.util.UniqueTicketIdGenerator; //导入依赖的package包/类
public void setTicketIdGenerator(final UniqueTicketIdGenerator generator) {
this.ticketIdGenerator = generator;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:4,代码来源:GenerateLoginTicketAction.java
示例20: prepareNewCAS
import org.jasig.cas.util.UniqueTicketIdGenerator; //导入依赖的package包/类
@Before
public void prepareNewCAS() {
this.authentication = mock(Authentication.class);
when(this.authentication.getAuthenticationDate()).thenReturn(new Date());
final CredentialMetaData metadata = new BasicCredentialMetaData(TestUtils.getCredentialsWithSameUsernameAndPassword("principal"));
final Map<String, HandlerResult> successes = new HashMap<>();
successes.put("handler1", new DefaultHandlerResult(mock(AuthenticationHandler.class), metadata));
when(this.authentication.getCredentials()).thenReturn(Arrays.asList(metadata));
when(this.authentication.getSuccesses()).thenReturn(successes);
when(this.authentication.getPrincipal()).thenReturn(new DefaultPrincipalFactory().createPrincipal(PRINCIPAL));
final Service service1 = TestUtils.getService(SVC1_ID);
final ServiceTicket stMock = createMockServiceTicket(ST_ID, service1);
final TicketGrantingTicket tgtRootMock = createRootTicketGrantingTicket();
final TicketGrantingTicket tgtMock = createMockTicketGrantingTicket(TGT_ID, stMock, false,
tgtRootMock, new ArrayList<Authentication>());
when(tgtMock.getProxiedBy()).thenReturn(TestUtils.getService("proxiedBy"));
final List<Authentication> authnListMock = mock(List.class);
//Size is required to be 2, so that we can simulate proxying capabilities
when(authnListMock.size()).thenReturn(2);
when(authnListMock.get(anyInt())).thenReturn(this.authentication);
when(tgtMock.getChainedAuthentications()).thenReturn(authnListMock);
when(stMock.getGrantingTicket()).thenReturn(tgtMock);
final Service service2 = TestUtils.getService(SVC2_ID);
final ServiceTicket stMock2 = createMockServiceTicket(ST2_ID, service2);
final TicketGrantingTicket tgtMock2 = createMockTicketGrantingTicket(TGT2_ID, stMock2, false, tgtRootMock, authnListMock);
//Mock TicketRegistry
this.ticketRegMock = mock(TicketRegistry.class);
when(ticketRegMock.getTicket(eq(tgtMock.getId()), eq(TicketGrantingTicket.class))).thenReturn(tgtMock);
when(ticketRegMock.getTicket(eq(tgtMock2.getId()), eq(TicketGrantingTicket.class))).thenReturn(tgtMock2);
when(ticketRegMock.getTicket(eq(stMock.getId()), eq(ServiceTicket.class))).thenReturn(stMock);
when(ticketRegMock.getTicket(eq(stMock2.getId()), eq(ServiceTicket.class))).thenReturn(stMock2);
when(ticketRegMock.getTickets()).thenReturn(Arrays.asList(tgtMock, tgtMock2, stMock, stMock2));
//Mock ServicesManager
final RegisteredService mockRegSvc1 = createMockRegisteredService(service1.getId(), true, getServiceProxyPolicy(false));
final RegisteredService mockRegSvc2 = createMockRegisteredService("test", false, getServiceProxyPolicy(true));
final RegisteredService mockRegSvc3 = createMockRegisteredService(service2.getId(), true, getServiceProxyPolicy(true));
final ServicesManager smMock = mock(ServicesManager.class);
when(smMock.findServiceBy(argThat(new VerifyServiceByIdMatcher(service1.getId())))).thenReturn(mockRegSvc1);
when(smMock.findServiceBy(argThat(new VerifyServiceByIdMatcher("test")))).thenReturn(mockRegSvc2);
when(smMock.findServiceBy(argThat(new VerifyServiceByIdMatcher(service2.getId())))).thenReturn(mockRegSvc3);
final Map ticketIdGenForServiceMock = mock(Map.class);
when(ticketIdGenForServiceMock.containsKey(any())).thenReturn(true);
when(ticketIdGenForServiceMock.get(any())).thenReturn(new DefaultUniqueTicketIdGenerator());
this.cas = new CentralAuthenticationServiceImpl(ticketRegMock, mock(AuthenticationManager.class),
mock(UniqueTicketIdGenerator.class), ticketIdGenForServiceMock, mock(ExpirationPolicy.class),
mock(ExpirationPolicy.class), smMock, mock(LogoutManager.class));
}
开发者ID:xuchengdong,项目名称:cas4.1.9,代码行数:59,代码来源:CentralAuthenticationServiceImplWithMockitoTests.java
注:本文中的org.jasig.cas.util.UniqueTicketIdGenerator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论