本文整理汇总了Java中org.jasig.cas.client.validation.Cas20ServiceTicketValidator类的典型用法代码示例。如果您正苦于以下问题:Java Cas20ServiceTicketValidator类的具体用法?Java Cas20ServiceTicketValidator怎么用?Java Cas20ServiceTicketValidator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Cas20ServiceTicketValidator类属于org.jasig.cas.client.validation包,在下文中一共展示了Cas20ServiceTicketValidator类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: init
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator; //导入依赖的package包/类
public void init(FilterConfig filterConfig) throws ServletException {
String casServerLoginUrl = "http://sso.jadyer.com:8080/cas-server-web/login";
String casServerUrlPrefix = "http://sso.jadyer.com:8080/cas-server-web";
String casClientServerName = "http://boss.jadyer.com:8080";
AuthenticationFilter casAuthenticationFilter = new AuthenticationFilter();
casAuthenticationFilter.setCasServerLoginUrl(casServerLoginUrl);
casAuthenticationFilter.setServerName(casClientServerName);
Cas20ProxyReceivingTicketValidationFilter casTicketValidationFilter = new Cas20ProxyReceivingTicketValidationFilter();
casTicketValidationFilter.setServerName(casClientServerName);
casTicketValidationFilter.setTicketValidator(new Cas20ServiceTicketValidator(casServerUrlPrefix));
filters[0] = new SingleSignOutFilter();
// filters[1] = new AuthenticationFilter();
// filters[2] = new Cas20ProxyReceivingTicketValidationFilter();
filters[1] = casAuthenticationFilter;
filters[2] = casTicketValidationFilter;
filters[3] = new HttpServletRequestWrapperFilter();
filters[4] = new AssertionThreadLocalFilter();
for(Filter obj : filters){
System.out.println("[复合Filter]-->Initializing Filter defined in ApplicationContext: '" + obj.toString() + "'");
obj.init(filterConfig);
}
}
开发者ID:v5java,项目名称:demo-cas-client,代码行数:23,代码来源:MSCompositeFilter.java
示例2: getCas20ProxyReceivingTicketValidationFilter
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator; //导入依赖的package包/类
public Cas20ProxyReceivingTicketValidationFilter getCas20ProxyReceivingTicketValidationFilter() {
Cas20ProxyReceivingTicketValidationFilter cas20ProxyReceivingTicketValidationFilter = new Cas20ProxyReceivingTicketValidationFilter();
cas20ProxyReceivingTicketValidationFilter.setServerName(serverUrl);
cas20ProxyReceivingTicketValidationFilter.setTicketValidator(new Cas20ServiceTicketValidator(casServerUrlPrefix));
cas20ProxyReceivingTicketValidationFilter.setRedirectAfterValidation(true);
return cas20ProxyReceivingTicketValidationFilter;
}
开发者ID:XiaoMi,项目名称:shepher,代码行数:8,代码来源:WebSecurityConfig.java
示例3: authenticate
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator; //导入依赖的package包/类
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
if (authentication.getDetails() instanceof ProxyCallbackAndServiceAuthenticationDetails &&
getTicketValidator() instanceof Cas20ServiceTicketValidator) {
String proxyCallbackUrl = ((ProxyCallbackAndServiceAuthenticationDetails) authentication.getDetails())
.getProxyCallbackUrl();
((Cas20ServiceTicketValidator) getTicketValidator()).setProxyCallbackUrl(proxyCallbackUrl);
}
return super.authenticate(authentication);
}
开发者ID:kakawait,项目名称:cas-security-spring-boot-starter,代码行数:11,代码来源:DynamicProxyCallbackUrlCasAuthenticationProvider.java
示例4: build
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator; //导入依赖的package包/类
@Override
public TicketValidator build() {
Cas20ServiceTicketValidator ticketValidator = new Cas20ServiceTicketValidator(casServerUrlPrefix);
if (proxyChainsValidation != null) {
logger.warn(OMISSION_MESSAGE_TEMPLATE, "proxyChainsValidation");
}
if (proxyChains != null) {
logger.warn(OMISSION_MESSAGE_TEMPLATE, "proxyChains");
}
if (allowEmptyProxyChain != null) {
logger.warn(OMISSION_MESSAGE_TEMPLATE, "allowEmptyProxyChain");
}
configure(ticketValidator);
return ticketValidator;
}
开发者ID:kakawait,项目名称:cas-security-spring-boot-starter,代码行数:16,代码来源:CasTicketValidatorBuilder.java
示例5: configure
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator; //导入依赖的package包/类
@Override
protected void configure(Cas20ServiceTicketValidator ticketValidator) {
super.configure(ticketValidator);
if (proxyGrantingTicketStorage != null) {
ticketValidator.setProxyGrantingTicketStorage(proxyGrantingTicketStorage);
}
if (proxyRetriever != null) {
ticketValidator.setProxyRetriever(proxyRetriever);
}
if (StringUtils.hasText(proxyCallbackUrl)) {
ticketValidator.setProxyCallbackUrl(proxyCallbackUrl);
}
}
开发者ID:kakawait,项目名称:cas-security-spring-boot-starter,代码行数:14,代码来源:CasTicketValidatorBuilder.java
示例6: testDoGetBadTicket
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator; //导入依赖的package包/类
@Test
public void testDoGetBadTicket() throws Exception {
//Mock some objects.
HttpServletRequest request = createDoGetHttpServletRequest(CONVERSATION_TICKET, TICKET, "false");
HttpServletResponse response = createMockHttpServletResponse();
Cas20ServiceTicketValidator ticketValidator = PowerMockito.mock(Cas20ServiceTicketValidator.class);
PowerMockito.when(ticketValidator.validate(TICKET, URL_WITH_CONVERSATION)).thenThrow(new TicketValidationException("Invalid Ticket"));
PowerMockito.mockStatic(ExternalAuthentication.class);
BDDMockito.given(ExternalAuthentication.startExternalAuthentication(request)).willThrow(new ExternalAuthenticationException());
//Prep our object
ShibcasAuthServlet shibcasAuthServlet = createShibcasAuthServlet();
//Override the internal Cas20TicketValidator because we don't want it to call a real server
MemberModifier.field(ShibcasAuthServlet.class, "ticketValidator").set(shibcasAuthServlet, ticketValidator);
//Standard request/response - bad ticket
BDDMockito.given(request.getAttribute(ExternalAuthentication.FORCE_AUTHN_PARAM)).willReturn("false");
BDDMockito.given(request.getAttribute(ExternalAuthentication.PASSIVE_AUTHN_PARAM)).willReturn("false");
shibcasAuthServlet.doGet(request, response);
//Verify
verify(request).getRequestDispatcher("/no-conversation-state.jsp");
verify(response).setStatus(404);
}
开发者ID:Unicon,项目名称:shib-cas-authn3,代码行数:27,代码来源:ShibcasAuthServletTest.java
示例7: casAuthenticationProvider
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(CasAuthenticationProvider.class)
public CasAuthenticationProvider casAuthenticationProvider(){
CasAuthenticationProvider casProvider = new CasAuthenticationProvider();
casProvider.setAuthenticationUserDetailsService(new UserDetailsByNameServiceWrapper<>(userDetailsService));
casProvider.setServiceProperties(serviceProperties());
casProvider.setTicketValidator(new Cas20ServiceTicketValidator(bootSecurityConfig.getCas().getCasServerUrl()));
casProvider.setKey(bootSecurityConfig.getCas().getKey());
return casProvider;
}
开发者ID:wayshall,项目名称:onetwo,代码行数:11,代码来源:CasSsoContextConfig.java
示例8: testDoGetStandard
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator; //导入依赖的package包/类
@Test
public void testDoGetStandard() throws Exception {
//Mock some objects.
HttpServletRequest request = createDoGetHttpServletRequest(CONVERSATION_TICKET, TICKET, null);
HttpServletResponse response = createMockHttpServletResponse();
Assertion assertion = createMockAssertion();
Cas20ServiceTicketValidator ticketValidator = PowerMockito.mock(Cas20ServiceTicketValidator.class);
PowerMockito.when(ticketValidator.validate(TICKET, URL_WITH_CONVERSATION)).thenReturn(assertion);
PowerMockito.mockStatic(ExternalAuthentication.class);
BDDMockito.given(ExternalAuthentication.startExternalAuthentication(request)).willReturn(E1S1);
//Prep our object
ShibcasAuthServlet shibcasAuthServlet = createShibcasAuthServlet();
//Override the internal Cas20TicketValidator because we don't want it to call a real server
MemberModifier.field(ShibcasAuthServlet.class, "ticketValidator").set(shibcasAuthServlet, ticketValidator);
//Standard request/response
BDDMockito.given(request.getAttribute(ExternalAuthentication.FORCE_AUTHN_PARAM)).willReturn("false");
BDDMockito.given(request.getAttribute(ExternalAuthentication.PASSIVE_AUTHN_PARAM)).willReturn("false");
shibcasAuthServlet.doGet(request, response);
//Verify
verify(request).setAttribute(ExternalAuthentication.PRINCIPAL_NAME_KEY, JDOE);
}
开发者ID:Unicon,项目名称:shib-cas-authn3,代码行数:28,代码来源:ShibcasAuthServletTest.java
示例9: testDoGetPassiveAuthenticated
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator; //导入依赖的package包/类
@Test
public void testDoGetPassiveAuthenticated() throws Exception {
//Mock some objects.
HttpServletRequest request = createDoGetHttpServletRequest(CONVERSATION_TICKET + "&gatewayAttempted=true", TICKET, "true");
HttpServletResponse response = createMockHttpServletResponse();
Assertion assertion = createMockAssertion();
Cas20ServiceTicketValidator ticketValidator = PowerMockito.mock(Cas20ServiceTicketValidator.class);
PowerMockito.when(ticketValidator.validate(TICKET, URL_WITH_CONVERSATION_GATEWAY_ATTEMPTED)).thenReturn(assertion);
PowerMockito.mockStatic(ExternalAuthentication.class);
BDDMockito.given(ExternalAuthentication.startExternalAuthentication(request)).willReturn(E1S1);
//Prep our object
ShibcasAuthServlet shibcasAuthServlet = createShibcasAuthServlet();
//Override the internal Cas20TicketValidator because we don't want it to call a real server
MemberModifier.field(ShibcasAuthServlet.class, "ticketValidator").set(shibcasAuthServlet, ticketValidator);
//Passive request/response with authenticated user
BDDMockito.given(request.getAttribute(ExternalAuthentication.FORCE_AUTHN_PARAM)).willReturn("false");
BDDMockito.given(request.getAttribute(ExternalAuthentication.PASSIVE_AUTHN_PARAM)).willReturn("true");
shibcasAuthServlet.doGet(request, response);
//Verify
verify(request).setAttribute(ExternalAuthentication.PRINCIPAL_NAME_KEY, JDOE);
}
开发者ID:Unicon,项目名称:shib-cas-authn3,代码行数:28,代码来源:ShibcasAuthServletTest.java
示例10: testDoGetPassiveNotAuthenticated
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator; //导入依赖的package包/类
@Test
public void testDoGetPassiveNotAuthenticated() throws Exception {
//Mock some objects.
HttpServletRequest request = createDoGetHttpServletRequest("conversation=e1s1&gatewayAttempted=true", null, "true");
HttpServletResponse response = createMockHttpServletResponse();
Cas20ServiceTicketValidator ticketValidator = PowerMockito.mock(Cas20ServiceTicketValidator.class);
PowerMockito.mockStatic(ExternalAuthentication.class);
BDDMockito.given(ExternalAuthentication.startExternalAuthentication(request)).willReturn(E1S1);
//Prep our object
ShibcasAuthServlet shibcasAuthServlet = createShibcasAuthServlet();
//Override the internal Cas20TicketValidator because we don't want it to call a real server
MemberModifier.field(ShibcasAuthServlet.class, "ticketValidator").set(shibcasAuthServlet, ticketValidator);
//Passive request/response with no user
BDDMockito.given(request.getAttribute(ExternalAuthentication.FORCE_AUTHN_PARAM)).willReturn("false");
BDDMockito.given(request.getAttribute(ExternalAuthentication.PASSIVE_AUTHN_PARAM)).willReturn("true");
shibcasAuthServlet.doGet(request, response);
//Verify
verify(request, never()).setAttribute(eq(ExternalAuthentication.PRINCIPAL_NAME_KEY), any());
verify(request).setAttribute(ExternalAuthentication.AUTHENTICATION_ERROR_KEY, "NoPassive");
verify(ticketValidator, never()).validate(anyString(), anyString());
}
开发者ID:Unicon,项目名称:shib-cas-authn3,代码行数:28,代码来源:ShibcasAuthServletTest.java
示例11: testDoGetForced
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator; //导入依赖的package包/类
@Test
public void testDoGetForced() throws Exception {
//Mock some objects.
HttpServletRequest request = createDoGetHttpServletRequest(CONVERSATION_TICKET, TICKET, null);
HttpServletResponse response = createMockHttpServletResponse();
Assertion assertion = createMockAssertion();
Cas20ServiceTicketValidator ticketValidator = PowerMockito.mock(Cas20ServiceTicketValidator.class);
PowerMockito.when(ticketValidator.validate(TICKET, URL_WITH_CONVERSATION)).thenReturn(assertion);
PowerMockito.mockStatic(ExternalAuthentication.class);
BDDMockito.given(ExternalAuthentication.startExternalAuthentication(request)).willReturn(E1S1);
//Prep our object
ShibcasAuthServlet shibcasAuthServlet = createShibcasAuthServlet();
//Override the internal Cas20TicketValidator because we don't want it to call a real server
MemberModifier.field(ShibcasAuthServlet.class, "ticketValidator").set(shibcasAuthServlet, ticketValidator);
//Forced request/response
BDDMockito.given(request.getAttribute(ExternalAuthentication.FORCE_AUTHN_PARAM)).willReturn("true");
BDDMockito.given(request.getAttribute(ExternalAuthentication.PASSIVE_AUTHN_PARAM)).willReturn("false");
shibcasAuthServlet.doGet(request, response);
//Verify
verify(request).setAttribute(ExternalAuthentication.PRINCIPAL_NAME_KEY, JDOE);
}
开发者ID:Unicon,项目名称:shib-cas-authn3,代码行数:28,代码来源:ShibcasAuthServletTest.java
示例12: testDoGetPassiveAndForced
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator; //导入依赖的package包/类
@Test
public void testDoGetPassiveAndForced() throws Exception {
//Mock some objects.
HttpServletRequest request = createDoGetHttpServletRequest(CONVERSATION_TICKET_GATEWAY_ATTEMPTED, TICKET, "true");
HttpServletResponse response = createMockHttpServletResponse();
Assertion assertion = createMockAssertion();
Cas20ServiceTicketValidator ticketValidator = PowerMockito.mock(Cas30ServiceTicketValidator.class);
PowerMockito.when(ticketValidator.validate(TICKET, URL_WITH_CONVERSATION_GATEWAY_ATTEMPTED)).thenReturn(assertion);
PowerMockito.mockStatic(ExternalAuthentication.class);
BDDMockito.given(ExternalAuthentication.startExternalAuthentication(request)).willReturn(E1S1);
//Prep our object
ShibcasAuthServlet shibcasAuthServlet = createShibcasAuthServlet();
//Override the internal Cas30TicketValidator because we don't want it to call a real server
MemberModifier.field(ShibcasAuthServlet.class, "ticketValidator").set(shibcasAuthServlet, ticketValidator);
//Passive and forced request/response
BDDMockito.given(request.getAttribute(ExternalAuthentication.FORCE_AUTHN_PARAM)).willReturn("true");
BDDMockito.given(request.getAttribute(ExternalAuthentication.PASSIVE_AUTHN_PARAM)).willReturn("true");
shibcasAuthServlet.doGet(request, response);
//Verify
verify(request).setAttribute(ExternalAuthentication.PRINCIPAL_NAME_KEY, JDOE);
}
开发者ID:Unicon,项目名称:shib-cas-authn3,代码行数:28,代码来源:ShibcasAuthServletTest.java
示例13: instantiateValidator
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator; //导入依赖的package包/类
public Cas20ServiceTicketValidator instantiateValidator()
{
Cas20ServiceTicketValidator toReturn = new Cas20ServiceTicketValidator(casServiceUrl);
toReturn.setProxyGrantingTicketStorage(proxyGrantingTicketStorage);
toReturn.setProxyCallbackUrl(proxyCallbackUrl);
return toReturn;
}
开发者ID:ozoneplatform,项目名称:owf-security,代码行数:8,代码来源:CasTicketValidatorFactoryImpl.java
示例14: searchExperiment
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator; //导入依赖的package包/类
public void searchExperiment() throws ServerConnectionException, FailedLoginException,
ClientProtocolException, IOException {
SearchExperimentsByCriteria experimentSearchCriteria = new SearchExperimentsByCriteria();
CaArrayServer server = new CaArrayServer(BaseProperties.getServerHostname(),
BaseProperties.getServerJndiPort());
server.connect();
/*
* Verify anonymous search does not return results.
*/
experimentSearchCriteria.doSearch(server);
// Emulate a login from caIntegrator through CAS
String ticket = login();
/*
* Validate the ticket.
*/
try {
Cas20ServiceTicketValidator v = new Cas20ServiceTicketValidator(BaseProperties.CAS_URL);
v.validate(ticket, BaseProperties.getServiceURLforCAS());
} catch (Exception e) {
System.out.println(e);
}
/*
* To properly authenticate users with CAS information for EJB calls the caArray application requires 2 pieces of information:
* + The service value that was used at authentication time when the ticket was created
* + The ticket value that was provided by CAS
*/
server.connect(BaseProperties.getServiceURLforCAS(), ticket);
experimentSearchCriteria.doSearch(server);
/*
* This shows that in addition to being able to authenticate with CAS the application also provides
* the capability to authenticate against ldap in an SSO environment.
*/
server.connect(BaseProperties.CAS_USERNAME, BaseProperties.CAS_USER_CAARRAY_PASSWORD);
experimentSearchCriteria.doSearch(server);
}
开发者ID:NCIP,项目名称:caarray,代码行数:40,代码来源:CASRemoteEJBClient.java
示例15: cas20ServiceTicketValidator
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator; //导入依赖的package包/类
@Bean
public Cas20ServiceTicketValidator cas20ServiceTicketValidator() {
return new Cas20ServiceTicketValidator(casProperties.getCasServerUrl());
}
开发者ID:mouxiao,项目名称:shootmimi,代码行数:5,代码来源:CasSecurityConfig.java
示例16: testRestBasicWithCas20TicketValidator
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator; //导入依赖的package包/类
@Test
public void testRestBasicWithCas20TicketValidator() throws HttpAction, UnsupportedEncodingException {
final CasRestAuthenticator authenticator = new CasRestAuthenticator(CAS_PREFIX_URL);
authenticator.setTicketValidator(new Cas20ServiceTicketValidator(CAS_PREFIX_URL));
internalTestRestBasic(new CasRestBasicAuthClient(authenticator, VALUE, NAME), 0);
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:7,代码来源:CasRestClientIT.java
示例17: cas20ServiceTicketValidator
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator; //导入依赖的package包/类
@Bean
public Cas20ServiceTicketValidator cas20ServiceTicketValidator() {
return new Cas20ServiceTicketValidator(env.getRequiredProperty(CAS_URL_PREFIX));
}
开发者ID:jgribonvald,项目名称:demo-spring-security-cas,代码行数:5,代码来源:SecurityConfiguration.java
示例18: doFilter
import org.jasig.cas.client.validation.Cas20ServiceTicketValidator; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse,
final FilterChain chain) throws IOException, ServletException {
final HttpServletRequest request = (HttpServletRequest) servletRequest;
final HttpServletResponse response = (HttpServletResponse) servletResponse;
HttpSession session = request.getSession();
final String ticket = CommonUtils.safeGetParameter(request, getArtifactParameterName());
if (session != null && session.getAttribute(CONST_CAS_ASSERTION) == null && ticket != null) {
try {
final String service = constructServiceUrl(request, response);
Cas20ServiceTicketValidator v = new Cas20ServiceTicketValidator(casServerUrl);
v.validate(ticket, service);
if (!new WebAuthentication().login(service, ticket)) {
throw new GeneralSecurityException("JBoss Web authentication failed.");
}
/*
* This line of obtaining the session again was necessary as following the login with
* the WebAuthentication above, the original Session that was obtained was no longer
* valid.
*/
session = request.getSession();
if (request.getUserPrincipal() instanceof AssertionPrincipal) {
final AssertionPrincipal principal = (AssertionPrincipal) request.getUserPrincipal();
session.setAttribute(CONST_CAS_ASSERTION, principal.getAssertion());
} else {
throw new GeneralSecurityException(
"JBoss Web authentication did not produce CAS AssertionPrincipal.");
}
} catch (final GeneralSecurityException e) {
response.sendError(HttpServletResponse.SC_FORBIDDEN, e.getMessage());
} catch (TicketValidationException tve) {
response.sendError(HttpServletResponse.SC_FORBIDDEN, tve.getMessage());
}
} else if (session != null && request.getUserPrincipal() == null) {
// There is evidence that in some cases the principal can disappear
// in JBoss despite a valid session.
// This block forces consistency between principal and assertion.
session.removeAttribute(CONST_CAS_ASSERTION);
}
chain.doFilter(request, response);
}
开发者ID:NCIP,项目名称:caarray,代码行数:46,代码来源:CasWebAuthenticationFilter.java
注:本文中的org.jasig.cas.client.validation.Cas20ServiceTicketValidator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论