本文整理汇总了Java中org.jasig.cas.support.oauth.services.OAuthRegisteredService类的典型用法代码示例。如果您正苦于以下问题:Java OAuthRegisteredService类的具体用法?Java OAuthRegisteredService怎么用?Java OAuthRegisteredService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OAuthRegisteredService类属于org.jasig.cas.support.oauth.services包,在下文中一共展示了OAuthRegisteredService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getRegisteredOAuthService
import org.jasig.cas.support.oauth.services.OAuthRegisteredService; //导入依赖的package包/类
/**
* Locate the requested instance of {@link OAuthRegisteredService} by the given clientId.
* @param servicesManager the service registry DAO instance.
* @param clientId the client id by which the {@link OAuthRegisteredService} is to be located.
* @return null, or the located {@link OAuthRegisteredService} instance in the service registry.
*/
public static OAuthRegisteredService getRegisteredOAuthService(final ServicesManager servicesManager, final String clientId) {
final Iterator<RegisteredService> it = servicesManager.getAllServices().iterator();
while (it.hasNext()) {
final RegisteredService aService = it.next();
if (aService instanceof OAuthRegisteredService) {
final OAuthRegisteredService service = (OAuthRegisteredService) aService;
if (service.getClientId().equals(clientId)) {
return service;
}
}
}
return null;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:20,代码来源:OAuthUtils.java
示例2: verifyOAuthServices
import org.jasig.cas.support.oauth.services.OAuthRegisteredService; //导入依赖的package包/类
@Test
public void verifyOAuthServices() {
final OAuthRegisteredService r = new OAuthRegisteredService();
r.setName("test456");
r.setServiceId("testId");
r.setTheme("theme");
r.setDescription("description");
r.setAttributeReleasePolicy(new ReturnAllAttributeReleasePolicy());
r.setClientId("testoauthservice");
r.setClientSecret("anothertest");
r.setBypassApprovalPrompt(true);
final RegisteredService r2 = this.dao.save(r);
assertEquals(r, r2);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:15,代码来源:LdapServiceRegistryDaoTests.java
示例3: getRegisteredService
import org.jasig.cas.support.oauth.services.OAuthRegisteredService; //导入依赖的package包/类
private RegisteredService getRegisteredService(final String serviceId, final String secret) {
final OAuthRegisteredService registeredServiceImpl = new OAuthRegisteredService();
registeredServiceImpl.setName("The registered service name");
registeredServiceImpl.setServiceId(serviceId);
registeredServiceImpl.setClientId(CLIENT_ID);
registeredServiceImpl.setClientSecret(secret);
return registeredServiceImpl;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:9,代码来源:OAuth20AccessTokenControllerTests.java
示例4: getRegisteredService
import org.jasig.cas.support.oauth.services.OAuthRegisteredService; //导入依赖的package包/类
private RegisteredService getRegisteredService(final String serviceId, final String name) {
final OAuthRegisteredService registeredServiceImpl = new OAuthRegisteredService();
registeredServiceImpl.setName(name);
registeredServiceImpl.setServiceId(serviceId);
registeredServiceImpl.setClientId(CLIENT_ID);
return registeredServiceImpl;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:8,代码来源:OAuth20AuthorizeControllerTests.java
示例5: getRegisteredOAuthService
import org.jasig.cas.support.oauth.services.OAuthRegisteredService; //导入依赖的package包/类
/**
* Locate the requested instance of {@link OAuthRegisteredService} by the given clientId.
* @param servicesManager the service registry DAO instance.
* @param clientId the client id by which the {@link OAuthRegisteredService} is to be located.
* @return null, or the located {@link OAuthRegisteredService} instance in the service registry.
*/
public static OAuthRegisteredService getRegisteredOAuthService(final ServicesManager servicesManager,
final String clientId) {
final Iterator<RegisteredService> it = servicesManager.getAllServices().iterator();
while (it.hasNext()) {
final RegisteredService aService = it.next();
if (aService instanceof OAuthRegisteredService) {
final OAuthRegisteredService service = (OAuthRegisteredService) aService;
if (service.getClientId().equals(clientId)) {
return service;
}
}
}
return null;
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:21,代码来源:OAuthUtils.java
示例6: internalHandleRequest
import org.jasig.cas.support.oauth.services.OAuthRegisteredService; //导入依赖的package包/类
@Override
protected ModelAndView internalHandleRequest(final String method, final HttpServletRequest request,
final HttpServletResponse response) throws Exception {
final String redirectUri = request.getParameter(OAuthConstants.REDIRECT_URI);
logger.debug("{} : {}", OAuthConstants.REDIRECT_URI, redirectUri);
final String clientId = request.getParameter(OAuthConstants.CLIENT_ID);
logger.debug("{} : {}", OAuthConstants.CLIENT_ID, clientId);
final String clientSecret = request.getParameter(OAuthConstants.CLIENT_SECRET);
final String code = request.getParameter(OAuthConstants.CODE);
logger.debug("{} : {}", OAuthConstants.CODE, code);
final boolean isVerified = verifyAccessTokenRequest(response, redirectUri, clientId, clientSecret, code);
if (!isVerified) {
return OAuthUtils.writeTextError(response, OAuthConstants.INVALID_REQUEST, HttpStatus.SC_BAD_REQUEST);
}
final ServiceTicket serviceTicket = (ServiceTicket) ticketRegistry.getTicket(code);
// service ticket should be valid
if (serviceTicket == null || serviceTicket.isExpired()) {
logger.error("Code expired : {}", code);
return OAuthUtils.writeTextError(response, OAuthConstants.INVALID_GRANT, HttpStatus.SC_BAD_REQUEST);
}
final TicketGrantingTicket ticketGrantingTicket = serviceTicket.getGrantingTicket();
// remove service ticket
ticketRegistry.deleteTicket(serviceTicket.getId());
final OAuthRegisteredService registeredService = OAuthUtils.getRegisteredOAuthService(this.servicesManager, clientId);
final OAuthWebApplicationService service = new OAuthWebApplicationService(registeredService.getId());
final String accessTokenEncoded = this.accessTokenGenerator.generate(service, ticketGrantingTicket);
final int expires = (int) (this.timeout - TimeUnit.MILLISECONDS
.toSeconds(System.currentTimeMillis() - ticketGrantingTicket.getCreationTime()));
final String text = String.format("%s=%s&%s=%s", OAuthConstants.ACCESS_TOKEN, accessTokenEncoded, OAuthConstants.EXPIRES, expires);
logger.debug("OAuth access token response: {}", text);
response.setContentType("text/plain");
return OAuthUtils.writeText(response, text, HttpStatus.SC_OK);
}
开发者ID:yuweijun,项目名称:cas-server-4.2.1,代码行数:41,代码来源:OAuth20AccessTokenController.java
示例7: verifyOAuthServices
import org.jasig.cas.support.oauth.services.OAuthRegisteredService; //导入依赖的package包/类
@Test
public void verifyOAuthServices() {
final OAuthRegisteredService r = new OAuthRegisteredService();
r.setName("test456");
r.setServiceId("testId");
r.setTheme("theme");
r.setDescription("description");
r.setAttributeReleasePolicy(new ReturnAllAttributeReleasePolicy());
r.setClientId("testoauthservice");
r.setClientSecret("anothertest");
r.setBypassApprovalPrompt(true);
final RegisteredService r2 = this.serviceRegistryDao.save(r);
assertEquals(r, r2);
}
开发者ID:xuchengdong,项目名称:cas4.1.9,代码行数:15,代码来源:MongoServiceRegistryDaoTests.java
示例8: mapRegisteredService
import org.jasig.cas.support.oauth.services.OAuthRegisteredService; //导入依赖的package包/类
@Override
public void mapRegisteredService(final RegisteredService svc, final ServiceData bean) {
bean.setAssignedId(Long.toString(svc.getId()));
bean.setServiceId(svc.getServiceId());
bean.setName(svc.getName());
bean.setDescription(svc.getDescription());
if (svc.getLogo() != null) {
bean.setLogoUrl(svc.getLogo().toExternalForm());
}
bean.setRequiredHandlers(svc.getRequiredHandlers());
if (svc instanceof OAuthRegisteredCallbackAuthorizeService) {
bean.setType(RegisteredServiceTypeEditBean.OAUTH_CALLBACK_AUTHZ.toString());
}
if (svc instanceof OAuthRegisteredService) {
bean.setType(RegisteredServiceTypeEditBean.OAUTH.toString());
final OAuthRegisteredService oauth = (OAuthRegisteredService) svc;
final RegisteredServiceOAuthTypeEditBean oauthBean = bean.getOauth();
oauthBean.setBypass(oauth.isBypassApprovalPrompt());
oauthBean.setClientId(oauth.getClientId());
oauthBean.setClientSecret(oauth.getClientSecret());
}
bean.setTheme(svc.getTheme());
bean.setEvalOrder(svc.getEvaluationOrder());
final LogoutType logoutType = svc.getLogoutType();
switch (logoutType) {
case BACK_CHANNEL:
bean.setLogoutType(RegisteredServiceLogoutTypeEditBean.BACK.toString());
break;
case FRONT_CHANNEL:
bean.setLogoutType(RegisteredServiceLogoutTypeEditBean.FRONT.toString());
break;
default:
bean.setLogoutType(RegisteredServiceLogoutTypeEditBean.NONE.toString());
break;
}
final URL url = svc.getLogoutUrl();
if (url != null) {
bean.setLogoutUrl(url.toExternalForm());
}
final RegisteredServicePublicKey key = svc.getPublicKey();
final RegisteredServicePublicKeyEditBean pBean = bean.getPublicKey();
if (key != null) {
pBean.setAlgorithm(key.getAlgorithm());
pBean.setLocation(key.getLocation());
}
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:51,代码来源:DefaultRegisteredServiceMapper.java
示例9: internalHandleRequest
import org.jasig.cas.support.oauth.services.OAuthRegisteredService; //导入依赖的package包/类
@Override
protected ModelAndView internalHandleRequest(final String method, final HttpServletRequest request,
final HttpServletResponse response) throws Exception {
final String redirectUri = request.getParameter(OAuthConstants.REDIRECT_URI);
logger.debug("{} : {}", OAuthConstants.REDIRECT_URI, redirectUri);
final String clientId = request.getParameter(OAuthConstants.CLIENT_ID);
logger.debug("{} : {}", OAuthConstants.CLIENT_ID, clientId);
final String clientSecret = request.getParameter(OAuthConstants.CLIENT_SECRET);
final String code = request.getParameter(OAuthConstants.CODE);
logger.debug("{} : {}", OAuthConstants.CODE, code);
final boolean isVerified = verifyAccessTokenRequest(response, redirectUri, clientId, clientSecret, code);
if (!isVerified) {
return OAuthUtils.writeTextError(response, OAuthConstants.INVALID_REQUEST, HttpStatus.SC_BAD_REQUEST);
}
final ServiceTicket serviceTicket = (ServiceTicket) ticketRegistry.getTicket(code);
// service ticket should be valid
if (serviceTicket == null || serviceTicket.isExpired()) {
logger.error("Code expired : {}", code);
return OAuthUtils.writeTextError(response, OAuthConstants.INVALID_GRANT, HttpStatus.SC_BAD_REQUEST);
}
final TicketGrantingTicket ticketGrantingTicket = serviceTicket.getGrantingTicket();
// remove service ticket
ticketRegistry.deleteTicket(serviceTicket.getId());
final OAuthRegisteredService registeredService = OAuthUtils.getRegisteredOAuthService(this.servicesManager, clientId);
final OAuthWebApplicationService service = new OAuthWebApplicationService(registeredService.getId());
final String accessTokenEncoded = this.accessTokenGenerator.generate(service, ticketGrantingTicket);
final int expires = (int) (this.timeout - TimeUnit.MILLISECONDS
.toSeconds(System.currentTimeMillis() - ticketGrantingTicket.getCreationTime()));
final String text = String.format("%s=%s&%s=%s", OAuthConstants.ACCESS_TOKEN,
accessTokenEncoded, OAuthConstants.EXPIRES_IN, expires);
logger.debug("OAuth access token response: {}", text);
response.setContentType("text/plain");
return OAuthUtils.writeText(response, text, HttpStatus.SC_OK);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:42,代码来源:OAuth20AccessTokenController.java
示例10: verifyAccessTokenRequest
import org.jasig.cas.support.oauth.services.OAuthRegisteredService; //导入依赖的package包/类
/**
* Verify access token request by reviewing the values of
* client id, redirect uri, client secret, code, etc.
*
* @param response the response
* @param redirectUri the redirect uri
* @param clientId the client id
* @param clientSecret the client secret
* @param code the code
* @return true, if successful
*/
private boolean verifyAccessTokenRequest(final HttpServletResponse response, final String redirectUri,
final String clientId, final String clientSecret, final String code) {
// clientId is required
if (StringUtils.isBlank(clientId)) {
logger.error("Missing {}", OAuthConstants.CLIENT_ID);
return false;
}
// redirectUri is required
if (StringUtils.isBlank(redirectUri)) {
logger.error("Missing {}", OAuthConstants.REDIRECT_URI);
return false;
}
// clientSecret is required
if (StringUtils.isBlank(clientSecret)) {
logger.error("Missing {}", OAuthConstants.CLIENT_SECRET);
return false;
}
// code is required
if (StringUtils.isBlank(code)) {
logger.error("Missing {}", OAuthConstants.CODE);
return false;
}
final OAuthRegisteredService service = OAuthUtils.getRegisteredOAuthService(this.servicesManager, clientId);
if (service == null) {
logger.error("Unknown {} : {}", OAuthConstants.CLIENT_ID, clientId);
return false;
}
final String serviceId = service.getServiceId();
if (!redirectUri.matches(serviceId)) {
logger.error("Unsupported {} : {} for serviceId : {}", OAuthConstants.REDIRECT_URI, redirectUri, serviceId);
return false;
}
if (!StringUtils.equals(service.getClientSecret(), clientSecret)) {
logger.error("Wrong client secret for service {}", service);
return false;
}
return true;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:54,代码来源:OAuth20AccessTokenController.java
示例11: internalHandleRequest
import org.jasig.cas.support.oauth.services.OAuthRegisteredService; //导入依赖的package包/类
@Override
protected ModelAndView internalHandleRequest(final String method, final HttpServletRequest request,
final HttpServletResponse response) throws Exception {
final String clientId = request.getParameter(OAuthConstants.CLIENT_ID);
logger.debug("{} : {}", OAuthConstants.CLIENT_ID, clientId);
final String redirectUri = request.getParameter(OAuthConstants.REDIRECT_URI);
logger.debug("{} : {}", OAuthConstants.REDIRECT_URI, redirectUri);
final String state = request.getParameter(OAuthConstants.STATE);
logger.debug("{} : {}", OAuthConstants.STATE, state);
// clientId is required
if (StringUtils.isBlank(clientId)) {
logger.error("Missing {}", OAuthConstants.CLIENT_ID);
return new ModelAndView(OAuthConstants.ERROR_VIEW);
}
// redirectUri is required
if (StringUtils.isBlank(redirectUri)) {
logger.error("Missing {}", OAuthConstants.REDIRECT_URI);
return new ModelAndView(OAuthConstants.ERROR_VIEW);
}
final OAuthRegisteredService service = OAuthUtils.getRegisteredOAuthService(this.servicesManager, clientId);
if (service == null) {
logger.error("Unknown {} : {}", OAuthConstants.CLIENT_ID, clientId);
return new ModelAndView(OAuthConstants.ERROR_VIEW);
}
final String serviceId = service.getServiceId();
if (!redirectUri.matches(serviceId)) {
logger.error("Unsupported {} : {} for serviceId : {}", OAuthConstants.REDIRECT_URI, redirectUri, serviceId);
return new ModelAndView(OAuthConstants.ERROR_VIEW);
}
// keep info in session
final HttpSession session = request.getSession();
session.setAttribute(OAuthConstants.OAUTH20_CALLBACKURL, redirectUri);
session.setAttribute(OAuthConstants.OAUTH20_SERVICE_NAME, service.getName());
session.setAttribute(OAuthConstants.BYPASS_APPROVAL_PROMPT, service.isBypassApprovalPrompt());
session.setAttribute(OAuthConstants.OAUTH20_STATE, state);
final String callbackAuthorizeUrl = request.getRequestURL().toString()
.replace('/' + OAuthConstants.AUTHORIZE_URL, '/' + OAuthConstants.CALLBACK_AUTHORIZE_URL);
logger.debug("{} : {}", OAuthConstants.CALLBACK_AUTHORIZE_URL, callbackAuthorizeUrl);
final String loginUrlWithService = OAuthUtils.addParameter(loginUrl, OAuthConstants.SERVICE,
callbackAuthorizeUrl);
logger.debug("loginUrlWithService : {}", loginUrlWithService);
return OAuthUtils.redirectTo(loginUrlWithService);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:53,代码来源:OAuth20AuthorizeController.java
示例12: verifyAccessTokenRequest
import org.jasig.cas.support.oauth.services.OAuthRegisteredService; //导入依赖的package包/类
/**
* Verify access token request by reviewing the values of
* client id, redirect uri, client secret, code, etc.
*
* @param response the response
* @param redirectUri the redirect uri
* @param clientId the client id
* @param clientSecret the client secret
* @param code the code
* @return true, if successful
*/
private boolean verifyAccessTokenRequest(final HttpServletResponse response, final String redirectUri,
final String clientId, final String clientSecret, final String code) {
// clientId is required
if (StringUtils.isBlank(clientId)) {
LOGGER.error("Missing {}", OAuthConstants.CLIENT_ID);
return false;
}
// redirectUri is required
if (StringUtils.isBlank(redirectUri)) {
LOGGER.error("Missing {}", OAuthConstants.REDIRECT_URI);
return false;
}
// clientSecret is required
if (StringUtils.isBlank(clientSecret)) {
LOGGER.error("Missing {}", OAuthConstants.CLIENT_SECRET);
return false;
}
// code is required
if (StringUtils.isBlank(code)) {
LOGGER.error("Missing {}", OAuthConstants.CODE);
return false;
}
final OAuthRegisteredService service = OAuthUtils.getRegisteredOAuthService(this.servicesManager, clientId);
if (service == null) {
LOGGER.error("Unknown {} : {}", OAuthConstants.CLIENT_ID, clientId);
return false;
}
final String serviceId = service.getServiceId();
if (!redirectUri.matches(serviceId)) {
LOGGER.error("Unsupported {} : {} for serviceId : {}", OAuthConstants.REDIRECT_URI, redirectUri, serviceId);
return false;
}
if (!StringUtils.equals(service.getClientSecret(), clientSecret)) {
LOGGER.error("Wrong client secret for service {}", service);
return false;
}
return true;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:54,代码来源:OAuth20AccessTokenController.java
示例13: handleRequestInternal
import org.jasig.cas.support.oauth.services.OAuthRegisteredService; //导入依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(final HttpServletRequest request, final HttpServletResponse response)
throws Exception {
final String clientId = request.getParameter(OAuthConstants.CLIENT_ID);
LOGGER.debug("{} : {}", OAuthConstants.CLIENT_ID, clientId);
final String redirectUri = request.getParameter(OAuthConstants.REDIRECT_URI);
LOGGER.debug("{} : {}", OAuthConstants.REDIRECT_URI, redirectUri);
final String state = request.getParameter(OAuthConstants.STATE);
LOGGER.debug("{} : {}", OAuthConstants.STATE, state);
// clientId is required
if (StringUtils.isBlank(clientId)) {
LOGGER.error("Missing {}", OAuthConstants.CLIENT_ID);
return new ModelAndView(OAuthConstants.ERROR_VIEW);
}
// redirectUri is required
if (StringUtils.isBlank(redirectUri)) {
LOGGER.error("Missing {}", OAuthConstants.REDIRECT_URI);
return new ModelAndView(OAuthConstants.ERROR_VIEW);
}
final OAuthRegisteredService service = OAuthUtils.getRegisteredOAuthService(this.servicesManager, clientId);
if (service == null) {
LOGGER.error("Unknown {} : {}", OAuthConstants.CLIENT_ID, clientId);
return new ModelAndView(OAuthConstants.ERROR_VIEW);
}
final String serviceId = service.getServiceId();
if (!redirectUri.matches(serviceId)) {
LOGGER.error("Unsupported {} : {} for serviceId : {}", OAuthConstants.REDIRECT_URI, redirectUri, serviceId);
return new ModelAndView(OAuthConstants.ERROR_VIEW);
}
// keep info in session
final HttpSession session = request.getSession();
session.setAttribute(OAuthConstants.OAUTH20_CALLBACKURL, redirectUri);
session.setAttribute(OAuthConstants.OAUTH20_SERVICE_NAME, service.getName());
session.setAttribute(OAuthConstants.BYPASS_APPROVAL_PROMPT, service.isBypassApprovalPrompt());
session.setAttribute(OAuthConstants.OAUTH20_STATE, state);
final String callbackAuthorizeUrl = request.getRequestURL().toString()
.replace("/" + OAuthConstants.AUTHORIZE_URL, "/" + OAuthConstants.CALLBACK_AUTHORIZE_URL);
LOGGER.debug("{} : {}", OAuthConstants.CALLBACK_AUTHORIZE_URL, callbackAuthorizeUrl);
final String loginUrlWithService = OAuthUtils.addParameter(loginUrl, OAuthConstants.SERVICE,
callbackAuthorizeUrl);
LOGGER.debug("loginUrlWithService : {}", loginUrlWithService);
return OAuthUtils.redirectTo(loginUrlWithService);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:53,代码来源:OAuth20AuthorizeController.java
示例14: fromRegisteredService
import org.jasig.cas.support.oauth.services.OAuthRegisteredService; //导入依赖的package包/类
/**
* From registered service to a service bean.
*
* @param svc the svc
* @return the registered service bean
*/
public static RegisteredServiceEditBean fromRegisteredService(final RegisteredService svc) {
final RegisteredServiceEditBean serviceBean = new RegisteredServiceEditBean();
final ServiceData bean = serviceBean.getServiceData();
bean.setAssignedId(svc.getId());
bean.setServiceId(svc.getServiceId());
bean.setName(svc.getName());
bean.setDescription(svc.getDescription());
if (svc.getLogo() != null) {
bean.setLogoUrl(svc.getLogo().toExternalForm());
}
bean.setRequiredHandlers(svc.getRequiredHandlers());
configureAccessStrategy(svc, bean);
if (svc instanceof OAuthRegisteredCallbackAuthorizeService) {
bean.setType(RegisteredServiceTypeEditBean.OAUTH_CALLBACK_AUTHZ.toString());
}
if (svc instanceof OAuthRegisteredService) {
bean.setType(RegisteredServiceTypeEditBean.OAUTH.toString());
final OAuthRegisteredService oauth = (OAuthRegisteredService) svc;
final RegisteredServiceOAuthTypeEditBean oauthBean = bean.getOauth();
oauthBean.setBypass(oauth.isBypassApprovalPrompt());
oauthBean.setClientId(oauth.getClientId());
oauthBean.setClientSecret(oauth.getClientSecret());
}
bean.setTheme(svc.getTheme());
bean.setEvalOrder(svc.getEvaluationOrder());
final LogoutType logoutType = svc.getLogoutType();
switch (logoutType) {
case BACK_CHANNEL:
bean.setLogoutType(RegisteredServiceLogoutTypeEditBean.BACK.toString());
break;
case FRONT_CHANNEL:
bean.setLogoutType(RegisteredServiceLogoutTypeEditBean.FRONT.toString());
break;
default:
bean.setLogoutType(RegisteredServiceLogoutTypeEditBean.NONE.toString());
break;
}
final URL url = svc.getLogoutUrl();
if (url != null) {
bean.setLogoutUrl(url.toExternalForm());
}
final RegisteredServiceUsernameAttributeProvider provider = svc.getUsernameAttributeProvider();
final RegisteredServiceUsernameAttributeProviderEditBean uBean = bean.getUserAttrProvider();
configureUsernameAttributeProvider(provider, uBean);
final RegisteredServicePublicKey key = svc.getPublicKey();
final RegisteredServicePublicKeyEditBean pBean = bean.getPublicKey();
if (key != null) {
pBean.setAlgorithm(key.getAlgorithm());
pBean.setLocation(key.getLocation());
}
configureProxyPolicy(svc, bean);
configureAttributeReleasePolicy(svc, bean);
return serviceBean;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:68,代码来源:RegisteredServiceEditBean.java
示例15: verifyAccessTokenRequest
import org.jasig.cas.support.oauth.services.OAuthRegisteredService; //导入依赖的package包/类
private boolean verifyAccessTokenRequest(final HttpServletResponse response, final String redirectUri,
final String clientId, final String clientSecret, final String code) {
// clientId is required
if (StringUtils.isBlank(clientId)) {
LOGGER.error("Missing {}", OAuthConstants.CLIENT_ID);
return false;
}
// redirectUri is required
if (StringUtils.isBlank(redirectUri)) {
LOGGER.error("Missing {}", OAuthConstants.REDIRECT_URI);
return false;
}
// clientSecret is required
if (StringUtils.isBlank(clientSecret)) {
LOGGER.error("Missing {}", OAuthConstants.CLIENT_SECRET);
return false;
}
// code is required
if (StringUtils.isBlank(code)) {
LOGGER.error("Missing {}", OAuthConstants.CODE);
return false;
}
final OAuthRegisteredService service = OAuthUtils.getRegisteredOAuthService(this.servicesManager, clientId);
if (service == null) {
LOGGER.error("Unknown {} : {}", OAuthConstants.CLIENT_ID, clientId);
return false;
}
final String serviceId = service.getServiceId();
if (!redirectUri.matches(serviceId)) {
LOGGER.error("Unsupported {} : {} for serviceId : {}", OAuthConstants.REDIRECT_URI, redirectUri, serviceId);
return false;
}
if (!StringUtils.equals(service.getClientSecret(), clientSecret)) {
LOGGER.error("Wrong client secret for service {}", service);
return false;
}
return true;
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:43,代码来源:OAuth20AccessTokenController.java
注:本文中的org.jasig.cas.support.oauth.services.OAuthRegisteredService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论