本文整理汇总了C#中Service.getId方法的典型用法代码示例。如果您正苦于以下问题:C# Service.getId方法的具体用法?C# Service.getId怎么用?C# Service.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Service
的用法示例。
在下文中一共展示了Service.getId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: matches
public bool matches(Service service)
{
return this.id.Equals(service.getId());
}
示例2: grantServiceTicket
/**
* @throws IllegalArgumentException if TicketGrantingTicket ID, Credentials
* or Service are null.
*/
//@Audit(
// action="SERVICE_TICKET",
// actionResolverName="GRANT_SERVICE_TICKET_RESOLVER",
// resourceResolverName="GRANT_SERVICE_TICKET_RESOURCE_RESOLVER")
//@Profiled(tag="GRANT_SERVICE_TICKET", logFailuresSeparately = false)
//@Transactional(readOnly = false)
public string grantServiceTicket(string ticketGrantingTicketId, Service service, Credentials credentials)
{
//Assert.notNull(ticketGrantingTicketId, "ticketGrantingticketId cannot be null");
//Assert.notNull(service, "service cannot be null");
TicketGrantingTicket ticketGrantingTicket;
ticketGrantingTicket = (TicketGrantingTicket)this.ticketRegistry.getTicket(ticketGrantingTicketId, typeof(TicketGrantingTicket));
if (ticketGrantingTicket == null)
{
throw new InvalidTicketException();
}
lock (ticketGrantingTicket)
{
if (ticketGrantingTicket.isExpired())
{
this.ticketRegistry.deleteTicket(ticketGrantingTicketId);
throw new InvalidTicketException();
}
}
RegisteredService registeredService = this.servicesManager
.findServiceBy(service);
if (registeredService == null || !registeredService.isEnabled())
{
//log.warn("ServiceManagement: Unauthorized Service Access. Service [" + service.getId() + "] not found in Service Registry.");
throw new UnauthorizedServiceException();
}
if (!registeredService.isSsoEnabled() && credentials == null
&& ticketGrantingTicket.getCountOfUses() > 0)
{
//log.warn("ServiceManagement: Service Not Allowed to use SSO. Service [" + service.getId() + "]");
throw new UnauthorizedSsoServiceException();
}
//CAS-1019
List<Authentication> authns = ticketGrantingTicket.getChainedAuthentications();
if (authns.Count > 1)
{
if (!registeredService.isAllowedToProxy())
{
string message = string.Format("ServiceManagement: Service Attempted to Proxy, but is not allowed. Service: [%s] | Registered Service: [%s]", service.getId(), registeredService.ToString());
//log.warn(message);
throw new UnauthorizedProxyingException(message);
}
}
if (credentials != null)
{
try
{
Authentication authentication = this.authenticationManager
.authenticate(credentials);
Authentication originalAuthentication = ticketGrantingTicket.getAuthentication();
if (!(authentication.getPrincipal().Equals(originalAuthentication.getPrincipal()) && authentication.getAttributes().Equals(originalAuthentication.getAttributes())))
{
throw new TicketCreationException();
}
}
catch (AuthenticationException e)
{
throw new TicketCreationException(e);
}
}
// this code is a bit brittle by depending on the class name. Future versions (i.e. CAS4 will know inherently how to identify themselves)
UniqueTicketIdGenerator serviceTicketUniqueTicketIdGenerator = this.uniqueTicketIdGeneratorsForService
.FirstOrDefault(x => x.Key == service.GetType().FullName).Value;
ServiceTicket serviceTicket = ticketGrantingTicket
.grantServiceTicket(serviceTicketUniqueTicketIdGenerator
.getNewTicketId(TicketPrefix.ServiceTicket_PREFIX), service,
this.serviceTicketExpirationPolicy, credentials != null);
this.serviceTicketRegistry.addTicket(serviceTicket);
//if (log.isInfoEnabled()) {
// List<Authentication> authentications = serviceTicket.getGrantingTicket().getChainedAuthentications();
// string formatString = "Granted %s ticket [%s] for service [%s] for user [%s]";
// string type;
// string principalId = authentications.get(authentications.size()-1).getPrincipal().getId();
// if (authentications.size() == 1) {
// type = "service";
//.........这里部分代码省略.........