本文整理汇总了Java中org.apereo.cas.authentication.principal.Service.getId方法的典型用法代码示例。如果您正苦于以下问题:Java Service.getId方法的具体用法?Java Service.getId怎么用?Java Service.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apereo.cas.authentication.principal.Service
的用法示例。
在下文中一共展示了Service.getId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doExecute
import org.apereo.cas.authentication.principal.Service; //导入方法依赖的package包/类
@Override
protected Event doExecute(final RequestContext requestContext) throws Exception {
final Service service = this.serviceSelectionStrategy.resolveService(WebUtils.getService(requestContext));
if (service != null) {
final RegisteredService registeredService = this.servicesManager.findServiceBy(service);
RegisteredServiceAccessStrategyUtils.ensureServiceAccessIsAllowed(service, registeredService);
if (registeredService instanceof SamlRegisteredService) {
final SamlRegisteredService samlService = SamlRegisteredService.class.cast(registeredService);
final Optional<SamlRegisteredServiceServiceProviderMetadataFacade> adaptor =
SamlRegisteredServiceServiceProviderMetadataFacade.get(resolver, samlService, service.getId());
if (!adaptor.isPresent()) {
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE,
"Cannot find metadata linked to " + service.getId());
}
final SamlMetadataUIInfo mdui = MetadataUIUtils.locateMetadataUserInterfaceForEntityId(adaptor.get().getEntityDescriptor(),
service.getId(), registeredService);
WebUtils.putServiceUserInterfaceMetadata(requestContext, mdui);
}
}
return success();
}
示例2: getEntityIdAsParameter
import org.apereo.cas.authentication.principal.Service; //导入方法依赖的package包/类
/**
* Gets entity id as parameter.
*
* @param service the service
* @return the entity id as parameter
*/
protected static Optional<URIBuilder.BasicNameValuePair> getEntityIdAsParameter(final Service service) {
final URIBuilder builder = new URIBuilder(service.getId());
final Optional<URIBuilder.BasicNameValuePair> param = builder.getQueryParams().stream()
.filter(p -> p.getName().equals(SamlProtocolConstants.PARAMETER_ENTITY_ID)).findFirst();
return param;
}
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:13,代码来源:SamlIdPEntityIdAuthenticationServiceSelectionStrategy.java
示例3: getRealmAsParameter
import org.apereo.cas.authentication.principal.Service; //导入方法依赖的package包/类
private static Optional<NameValuePair> getRealmAsParameter(final Service service) {
try {
final URIBuilder builder = new URIBuilder(service.getId());
final Optional param = builder.getQueryParams()
.stream()
.filter(p -> p.getName().equals(WSFederationConstants.WTREALM))
.findFirst();
return param;
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
return Optional.empty();
}
示例4: resolveClientIdFromService
import org.apereo.cas.authentication.principal.Service; //导入方法依赖的package包/类
private static Optional<NameValuePair> resolveClientIdFromService(final Service service) {
try {
final URIBuilder builder = new URIBuilder(service.getId());
return builder.getQueryParams().stream().filter(p -> p.getName().equals(OAuth20Constants.CLIENT_ID)).findFirst();
} catch (final Exception e) {
LOGGER.error(e.getMessage());
}
return Optional.empty();
}
示例5: resolveRedirectUri
import org.apereo.cas.authentication.principal.Service; //导入方法依赖的package包/类
private static Optional<NameValuePair> resolveRedirectUri(final Service service) {
try {
final URIBuilder builder = new URIBuilder(service.getId());
return builder.getQueryParams().stream().filter(p -> p.getName().equals(OAuth20Constants.REDIRECT_URI)).findFirst();
} catch (final Exception e) {
LOGGER.error(e.getMessage());
}
return Optional.empty();
}
示例6: getEntityIdAsParameter
import org.apereo.cas.authentication.principal.Service; //导入方法依赖的package包/类
/**
* Gets entity id as parameter.
*
* @param service the service
* @return the entity id as parameter
*/
protected static Optional<String> getEntityIdAsParameter(final Service service) {
try {
final URIBuilder builder = new URIBuilder(service.getId());
final Optional<NameValuePair> param = builder.getQueryParams()
.stream()
.filter(p -> p.getName().equals(SamlProtocolConstants.PARAMETER_ENTITY_ID))
.findFirst();
if (param.isPresent()) {
return Optional.of(param.get().getValue());
}
final HttpServletRequest request = WebUtils.getHttpServletRequest();
final String[] query = request.getQueryString().split("&");
final Optional<String> paramRequest = Arrays.stream(query)
.map(p -> {
final String[] params = p.split("=");
return Pair.of(params[0], params[1]);
})
.filter(p -> p.getKey().equals(SamlProtocolConstants.PARAMETER_ENTITY_ID))
.map(Pair::getValue)
.findFirst();
return paramRequest;
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
return Optional.empty();
}
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:34,代码来源:ShibbolethIdPEntityIdAuthenticationServiceSelectionStrategy.java
示例7: callRestEndpointForMultifactor
import org.apereo.cas.authentication.principal.Service; //导入方法依赖的package包/类
/**
* Call rest endpoint for multifactor.
*
* @param principal the principal
* @param context the context
* @return return the rest response, typically the mfa id.
*/
protected String callRestEndpointForMultifactor(final Principal principal, final RequestContext context) {
final RestTemplate restTemplate = new RestTemplate();
final Service resolvedService = resolveServiceFromAuthenticationRequest(context);
final RestEndpointEntity entity = new RestEndpointEntity(principal.getId(), resolvedService.getId());
final ResponseEntity<String> responseEntity = restTemplate.postForEntity(restEndpoint, entity, String.class);
if (responseEntity != null && responseEntity.getStatusCode() == HttpStatus.OK) {
return responseEntity.getBody();
}
return null;
}
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:18,代码来源:RestEndpointMultifactorAuthenticationPolicyEventResolver.java
示例8: normalizePath
import org.apereo.cas.authentication.principal.Service; //导入方法依赖的package包/类
/**
* Normalize the path of a service by removing the query string and everything after a semi-colon.
*
* @param service the service to normalize
* @return the normalized path
*/
private static String normalizePath(final Service service) {
String path = service.getId();
path = StringUtils.substringBefore(path, "?");
path = StringUtils.substringBefore(path, ";");
path = StringUtils.substringBefore(path, "#");
return path;
}
示例9: getReplyAsParameter
import org.apereo.cas.authentication.principal.Service; //导入方法依赖的package包/类
private static Optional<NameValuePair> getReplyAsParameter(final Service service) {
try {
final URIBuilder builder = new URIBuilder(service.getId());
final Optional param = builder.getQueryParams()
.stream()
.filter(p -> p.getName().equals(WSFederationConstants.WREPLY))
.findFirst();
return param;
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
return Optional.empty();
}
示例10: resolveFrom
import org.apereo.cas.authentication.principal.Service; //导入方法依赖的package包/类
@Override
public String[] resolveFrom(final JoinPoint joinPoint, final Exception ex) {
final Service service = (Service) AopUtils.unWrapJoinPoint(joinPoint).getArgs()[1];
return new String[] {service.getId()};
}