当前位置: 首页>>代码示例>>C#>>正文


C# Service.getId方法代码示例

本文整理汇总了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());
 }
开发者ID:CSharpDev,项目名称:Dev.All,代码行数:4,代码来源:AbstractWebApplicationService.cs

示例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";

//.........这里部分代码省略.........
开发者ID:CSharpDev,项目名称:Dev.All,代码行数:101,代码来源:CentralAuthenticationServiceImpl.cs


注:本文中的Service.getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。