本文整理汇总了Java中org.jasig.cas.authentication.HttpBasedServiceCredential类的典型用法代码示例。如果您正苦于以下问题:Java HttpBasedServiceCredential类的具体用法?Java HttpBasedServiceCredential怎么用?Java HttpBasedServiceCredential使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HttpBasedServiceCredential类属于org.jasig.cas.authentication包,在下文中一共展示了HttpBasedServiceCredential类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: authenticate
import org.jasig.cas.authentication.HttpBasedServiceCredential; //导入依赖的package包/类
@Override
public HandlerResult authenticate(final Credential credential) throws GeneralSecurityException {
final HttpBasedServiceCredential httpCredential = (HttpBasedServiceCredential) credential;
if (!httpCredential.getService().getProxyPolicy().isAllowedProxyCallbackUrl(httpCredential.getCallbackUrl())) {
logger.warn("Proxy policy for service [{}] cannot authorize the requested callback url [{}].",
httpCredential.getService().getServiceId(), httpCredential.getCallbackUrl());
throw new FailedLoginException(httpCredential.getCallbackUrl() + " cannot be authorized");
}
logger.debug("Attempting to authenticate {}", httpCredential);
final URL callbackUrl = httpCredential.getCallbackUrl();
if (!this.httpClient.isValidEndPoint(callbackUrl)) {
throw new FailedLoginException(callbackUrl.toExternalForm() + " sent an unacceptable response status code");
}
return new DefaultHandlerResult(this, httpCredential, this.principalFactory.createPrincipal(httpCredential.getId()));
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:17,代码来源:HttpBasedServiceCredentialsAuthenticationHandler.java
示例2: SamlAuthenticationMetaDataPopulator
import org.jasig.cas.authentication.HttpBasedServiceCredential; //导入依赖的package包/类
/**
* Instantiates a new SAML authentication meta data populator.
*/
public SamlAuthenticationMetaDataPopulator() {
this.authenticationMethods.put(
HttpBasedServiceCredential.class.getName(),
AUTHN_METHOD_SSL_TLS_CLIENT);
this.authenticationMethods.put(
UsernamePasswordCredential.class.getName(),
AUTHN_METHOD_PASSWORD);
// Next two classes are in other modules, so avoid using Class#getName() to prevent circular dependency
this.authenticationMethods.put(
"org.jasig.cas.adaptors.trusted.authentication.principal.PrincipalBearingCredentials",
AUTHN_METHOD_UNSPECIFIED);
this.authenticationMethods.put(
"org.jasig.cas.adaptors.x509.authentication.principal.X509CertificateCredentials",
AUTHN_METHOD_X509_PUBLICKEY);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:20,代码来源:SamlAuthenticationMetaDataPopulator.java
示例3: authenticate
import org.jasig.cas.authentication.HttpBasedServiceCredential; //导入依赖的package包/类
@Override
public HandlerResult authenticate(final Credential credential) throws GeneralSecurityException {
final HttpBasedServiceCredential httpCredential = (HttpBasedServiceCredential) credential;
if (!httpCredential.getService().getProxyPolicy().isAllowedProxyCallbackUrl(httpCredential.getCallbackUrl())) {
logger.warn("Proxy policy for service [{}] cannot authorize the requested callbackurl [{}]",
httpCredential.getService(), httpCredential.getCallbackUrl());
throw new FailedLoginException(httpCredential.getCallbackUrl() + " cannot be authorized");
}
logger.debug("Attempting to authenticate {}", httpCredential);
final URL callbackUrl = httpCredential.getCallbackUrl();
if (!this.httpClient.isValidEndPoint(callbackUrl)) {
throw new FailedLoginException(callbackUrl.toExternalForm() + " sent an unacceptable response status code");
}
return new DefaultHandlerResult(this, httpCredential, this.principalFactory.createPrincipal(httpCredential.getId()));
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:17,代码来源:HttpBasedServiceCredentialsAuthenticationHandler.java
示例4: SamlAuthenticationMetaDataPopulator
import org.jasig.cas.authentication.HttpBasedServiceCredential; //导入依赖的package包/类
public SamlAuthenticationMetaDataPopulator() {
this.authenticationMethods.put(
HttpBasedServiceCredential.class.getName(),
AUTHN_METHOD_SSL_TLS_CLIENT);
this.authenticationMethods.put(
UsernamePasswordCredential.class.getName(),
AUTHN_METHOD_PASSWORD);
// Next two classes are in other modules, so avoid using Class#getName() to prevent circular dependency
this.authenticationMethods.put(
"org.jasig.cas.adaptors.trusted.authentication.principal.PrincipalBearingCredentials",
AUTHN_METHOD_UNSPECIFIED);
this.authenticationMethods.put(
"org.jasig.cas.adaptors.x509.authentication.principal.X509CertificateCredentials",
AUTHN_METHOD_X509_PUBLICKEY);
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:17,代码来源:SamlAuthenticationMetaDataPopulator.java
示例5: getServiceCredentialsFromRequest
import org.jasig.cas.authentication.HttpBasedServiceCredential; //导入依赖的package包/类
/**
* Overrideable method to determine which credentials to use to grant a
* proxy granting ticket. Default is to use the pgtUrl.
*
* @param service the webapp service requesting proxy
* @param request the HttpServletRequest object.
* @return the credentials or null if there was an error or no credentials
* provided.
*/
protected Credential getServiceCredentialsFromRequest(final WebApplicationService service, final HttpServletRequest request) {
final String pgtUrl = request.getParameter(CasProtocolConstants.PARAMETER_PROXY_CALLBACK_URL);
if (StringUtils.hasText(pgtUrl)) {
try {
final RegisteredService registeredService = this.servicesManager.findServiceBy(service);
verifyRegisteredServiceProperties(registeredService, service);
return new HttpBasedServiceCredential(new URL(pgtUrl), registeredService);
} catch (final Exception e) {
logger.error("Error constructing pgtUrl", e);
}
}
return null;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:24,代码来源:AbstractServiceValidateController.java
示例6: verifyDoesntSupportBadUserCredentials
import org.jasig.cas.authentication.HttpBasedServiceCredential; //导入依赖的package包/类
@Test
public void verifyDoesntSupportBadUserCredentials() {
try {
assertFalse(this.authenticationHandler
.supports(new HttpBasedServiceCredential(new URL(
"http://www.rutgers.edu"), org.jasig.cas.authentication.TestUtils.getRegisteredService())));
} catch (final MalformedURLException e) {
fail("Could not resolve URL.");
}
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:11,代码来源:RejectUsersAuthenticationHandlerTests.java
示例7: verifyDoesntSupportBadUserCredentials
import org.jasig.cas.authentication.HttpBasedServiceCredential; //导入依赖的package包/类
@Test
public void verifyDoesntSupportBadUserCredentials() {
try {
final HttpBasedServiceCredential c = new HttpBasedServiceCredential(
new URL("http://www.rutgers.edu"), org.jasig.cas.authentication.TestUtils.getRegisteredService());
assertFalse(this.authenticationHandler.supports(c));
} catch (final MalformedURLException e) {
fail("MalformedURLException caught.");
}
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:11,代码来源:FileAuthenticationHandlerTests.java
示例8: getHttpBasedServiceCredentials
import org.jasig.cas.authentication.HttpBasedServiceCredential; //导入依赖的package包/类
public static HttpBasedServiceCredential getHttpBasedServiceCredentials(
final String url) {
try {
return new HttpBasedServiceCredential(new URL(url),
TestUtils.getRegisteredService(url));
} catch (final MalformedURLException e) {
throw new IllegalArgumentException();
}
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:10,代码来源:TestUtils.java
示例9: handle
import org.jasig.cas.authentication.HttpBasedServiceCredential; //导入依赖的package包/类
@Override
public String handle(final Credential credential, final TicketGrantingTicket proxyGrantingTicketId) {
final HttpBasedServiceCredential serviceCredentials = (HttpBasedServiceCredential) credential;
final String proxyIou = this.uniqueTicketIdGenerator.getNewTicketId(ProxyGrantingTicket.PROXY_GRANTING_TICKET_IOU_PREFIX);
final URL callbackUrl = serviceCredentials.getCallbackUrl();
final String serviceCredentialsAsString = callbackUrl.toExternalForm();
final int bufferLength = serviceCredentialsAsString.length() + proxyIou.length()
+ proxyGrantingTicketId.getId().length() + BUFFER_LENGTH_ADDITIONAL_CHARGE;
final StringBuilder stringBuffer = new StringBuilder(bufferLength);
stringBuffer.append(serviceCredentialsAsString);
if (callbackUrl.getQuery() != null) {
stringBuffer.append('&');
} else {
stringBuffer.append('?');
}
stringBuffer.append(PARAMETER_PROXY_GRANTING_TICKET_IOU);
stringBuffer.append('=');
stringBuffer.append(proxyIou);
stringBuffer.append('&');
stringBuffer.append(PARAMETER_PROXY_GRANTING_TICKET_ID);
stringBuffer.append('=');
stringBuffer.append(proxyGrantingTicketId);
if (this.httpClient.isValidEndPoint(stringBuffer.toString())) {
logger.debug("Sent ProxyIou of {} for service: {}", proxyIou, serviceCredentials);
return proxyIou;
}
logger.debug("Failed to send ProxyIou of {} for service: {}", proxyIou, serviceCredentials);
return null;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:36,代码来源:Cas20ProxyHandler.java
示例10: verifyValidProxyTicketWithQueryString
import org.jasig.cas.authentication.HttpBasedServiceCredential; //导入依赖的package包/类
@Test
public void verifyValidProxyTicketWithQueryString() throws Exception {
assertNotNull(this.handler.handle(new HttpBasedServiceCredential(
new URL("https://www.google.com/?test=test"),
org.jasig.cas.authentication.TestUtils.getRegisteredService("https://some.app.edu")),
proxyGrantingTicket));
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:8,代码来源:Cas20ProxyHandlerTests.java
示例11: verifyNonValidProxyTicket
import org.jasig.cas.authentication.HttpBasedServiceCredential; //导入依赖的package包/类
@Test
public void verifyNonValidProxyTicket() throws Exception {
final SimpleHttpClientFactoryBean clientFactory = new SimpleHttpClientFactoryBean();
clientFactory.setAcceptableCodes(new int[] {900});
final HttpClient httpClient = clientFactory.getObject();
this.handler.setHttpClient(httpClient);
assertNull(this.handler.handle(new HttpBasedServiceCredential(new URL(
"http://www.rutgers.edu"),
org.jasig.cas.authentication.TestUtils.getRegisteredService("https://some.app.edu")), proxyGrantingTicket));
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:11,代码来源:Cas20ProxyHandlerTests.java
示例12: authenticate
import org.jasig.cas.authentication.HttpBasedServiceCredential; //导入依赖的package包/类
@Override
public DefaultHandlerResult authenticate(final Credential credential) throws GeneralSecurityException, PreventedException {
if (credential instanceof HttpBasedServiceCredential) {
return new DefaultHandlerResult(this, (HttpBasedServiceCredential) credential);
} else {
return new DefaultHandlerResult(this, new BasicCredentialMetaData(credential));
}
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:9,代码来源:KryoTranscoderTests.java
示例13: handle
import org.jasig.cas.authentication.HttpBasedServiceCredential; //导入依赖的package包/类
@Override
public String handle(final Credential credential, final TicketGrantingTicket proxyGrantingTicketId) {
final HttpBasedServiceCredential serviceCredentials = (HttpBasedServiceCredential) credential;
final String proxyIou = this.uniqueTicketIdGenerator.getNewTicketId(TicketGrantingTicket.PROXY_GRANTING_TICKET_IOU_PREFIX);
final URL callbackUrl = serviceCredentials.getCallbackUrl();
final String serviceCredentialsAsString = callbackUrl.toExternalForm();
final int bufferLength = serviceCredentialsAsString.length() + proxyIou.length()
+ proxyGrantingTicketId.getId().length() + BUFFER_LENGTH_ADDITIONAL_CHARGE;
final StringBuilder stringBuffer = new StringBuilder(bufferLength);
stringBuffer.append(serviceCredentialsAsString);
if (callbackUrl.getQuery() != null) {
stringBuffer.append('&');
} else {
stringBuffer.append('?');
}
stringBuffer.append(PARAMETER_PROXY_GRANTING_TICKET_IOU);
stringBuffer.append('=');
stringBuffer.append(proxyIou);
stringBuffer.append('&');
stringBuffer.append(PARAMETER_PROXY_GRANTING_TICKET_ID);
stringBuffer.append('=');
stringBuffer.append(proxyGrantingTicketId);
if (this.httpClient.isValidEndPoint(stringBuffer.toString())) {
logger.debug("Sent ProxyIou of {} for service: {}", proxyIou, serviceCredentials);
return proxyIou;
}
logger.debug("Failed to send ProxyIou of {} for service: {}", proxyIou, serviceCredentials);
return null;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:36,代码来源:Cas20ProxyHandler.java
示例14: verifyNonValidProxyTicket
import org.jasig.cas.authentication.HttpBasedServiceCredential; //导入依赖的package包/类
@Test
public void verifyNonValidProxyTicket() throws Exception {
final SimpleHttpClientFactoryBean clientFactory = new SimpleHttpClientFactoryBean();
clientFactory.setAcceptableCodes(new int[] {900});
final HttpClient httpClient = clientFactory.getObject();
this.handler.setHttpClient(httpClient);
assertNull(this.handler.handle(new HttpBasedServiceCredential(new URL(
"http://www.rutgers.edu"), TestUtils.getRegisteredService("https://some.app.edu")), proxyGrantingTicket));
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:10,代码来源:Cas20ProxyHandlerTests.java
示例15: getHttpBasedServiceCredentials
import org.jasig.cas.authentication.HttpBasedServiceCredential; //导入依赖的package包/类
public static HttpBasedServiceCredential getHttpBasedServiceCredentials(
final String url) {
try {
return new HttpBasedServiceCredential(new URL(url), TestUtils.getRegisteredService(url));
} catch (final MalformedURLException e) {
throw new IllegalArgumentException();
}
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:9,代码来源:TestUtils.java
示例16: verifyDoesntSupportBadUserCredentials
import org.jasig.cas.authentication.HttpBasedServiceCredential; //导入依赖的package包/类
@Test
public void verifyDoesntSupportBadUserCredentials() {
try {
final RegisteredServiceImpl svc = new RegisteredServiceImpl();
svc.setServiceId("https://some.app.edu");
assertFalse(this.authenticationHandler
.supports(new HttpBasedServiceCredential(new URL(
"http://www.rutgers.edu"), svc)));
} catch (final MalformedURLException e) {
fail("Could not resolve URL.");
}
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:13,代码来源:RejectUsersAuthenticationHandlerTests.java
示例17: verifyDoesntSupportBadUserCredentials
import org.jasig.cas.authentication.HttpBasedServiceCredential; //导入依赖的package包/类
@Test
public void verifyDoesntSupportBadUserCredentials() {
try {
final RegisteredServiceImpl svc = new RegisteredServiceImpl();
svc.setServiceId("https://some.app.edu");
final HttpBasedServiceCredential c = new HttpBasedServiceCredential(
new URL("http://www.rutgers.edu"), svc);
assertFalse(this.authenticationHandler.supports(c));
} catch (final MalformedURLException e) {
fail("MalformedURLException caught.");
}
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:13,代码来源:FileAuthenticationHandlerTests.java
示例18: internalProxyTest
import org.jasig.cas.authentication.HttpBasedServiceCredential; //导入依赖的package包/类
private void internalProxyTest(final String proxyUrl) throws MalformedURLException {
final RegisteredServiceImpl svc = new RegisteredServiceImpl();
svc.setServiceId("https://some.app.edu");
final Credential proxyCredential = new HttpBasedServiceCredential(new URL(proxyUrl), svc);
final TicketGrantingTicket expectedTGT = new MockTicketGrantingTicket(TGT_ID, proxyCredential, this.principalAttributes);
expectedTGT.grantServiceTicket(ST_ID, null, null, false);
assertEquals(expectedTGT, transcoder.decode(transcoder.encode(expectedTGT)));
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:9,代码来源:KryoTranscoderTests.java
示例19: handle
import org.jasig.cas.authentication.HttpBasedServiceCredential; //导入依赖的package包/类
public String handle(final Credential credential, final String proxyGrantingTicketId) {
final HttpBasedServiceCredential serviceCredentials = (HttpBasedServiceCredential) credential;
final String proxyIou = this.uniqueTicketIdGenerator.getNewTicketId(PGTIOU_PREFIX);
final String serviceCredentialsAsString = serviceCredentials.getCallbackUrl().toExternalForm();
final int bufferLength = serviceCredentialsAsString.length() + proxyIou.length() + proxyGrantingTicketId.length() + 15;
final StringBuilder stringBuffer = new StringBuilder(bufferLength);
stringBuffer.append(serviceCredentialsAsString);
if (serviceCredentials.getCallbackUrl().getQuery() != null) {
stringBuffer.append("&");
} else {
stringBuffer.append("?");
}
stringBuffer.append(PARAMETER_PROXY_GRANTING_TICKET_IOU);
stringBuffer.append("=");
stringBuffer.append(proxyIou);
stringBuffer.append("&");
stringBuffer.append(PARAMETER_PROXY_GRANTING_TICKET_ID);
stringBuffer.append("=");
stringBuffer.append(proxyGrantingTicketId);
if (this.httpClient.isValidEndPoint(stringBuffer.toString())) {
logger.debug("Sent ProxyIou of {} for service: {}", proxyIou, serviceCredentials.toString());
return proxyIou;
}
logger.debug("Failed to send ProxyIou of {} for service: {}", proxyIou, serviceCredentials.toString());
return null;
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:32,代码来源:Cas20ProxyHandler.java
示例20: authenticate
import org.jasig.cas.authentication.HttpBasedServiceCredential; //导入依赖的package包/类
public HandlerResult authenticate(final Credential credential) throws GeneralSecurityException {
final HttpBasedServiceCredential httpCredential = (HttpBasedServiceCredential) credential;
if (this.requireSecure && !httpCredential.getCallbackUrl().getProtocol().equals(PROTOCOL_HTTPS)) {
logger.debug("Authentication failed because url was not secure.");
throw new FailedLoginException(httpCredential.getCallbackUrl() + " is not an HTTPS endpoint as required.");
}
logger.debug("Attempting to authenticate {}", httpCredential);
if (!this.httpClient.isValidEndPoint(httpCredential.getCallbackUrl())) {
throw new FailedLoginException(
httpCredential.getCallbackUrl() + " sent an unacceptable response status code");
}
return new HandlerResult(this, httpCredential, new SimplePrincipal(httpCredential.getId()));
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:14,代码来源:HttpBasedServiceCredentialsAuthenticationHandler.java
注:本文中的org.jasig.cas.authentication.HttpBasedServiceCredential类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论