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


C# Credentials.GetType方法代码示例

本文整理汇总了C#中Credentials.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Credentials.GetType方法的具体用法?C# Credentials.GetType怎么用?C# Credentials.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Credentials的用法示例。


在下文中一共展示了Credentials.GetType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: authenticateAndObtainPrincipal

        /**
     * @throws IllegalArgumentException if a mapping cannot be found.
     * @see org.jasig.cas.authentication.AuthenticationManager#authenticate(org.jasig.cas.authentication.principal.Credentials)
     */
        //@Override
        protected override Pair<AuthenticationHandler, Principal> authenticateAndObtainPrincipal(Credentials credentials)
        {
            Type credentialsClass = credentials.GetType();
            DirectAuthenticationHandlerMappingHolder d = this.credentialsMapping.FirstOrDefault(x => x.Key == credentialsClass).Value;

            ////Assert.notNull(d, "no mapping found for: " + credentialsClass.getName());

            string handlerName = d.getAuthenticationHandler().GetType().FullName;
            bool authenticated = false;

            try
            {
                authenticated = d.getAuthenticationHandler().authenticate(credentials);
            }
            catch (Exception e)
            {
                this.handleError(handlerName, credentials, e);
            }

            if (!authenticated)
            {
                //log.info("{} failed to authenticate {}", handlerName, credentials);
                throw BadCredentialsAuthenticationException.ERROR;
            }
            //log.info("{} successfully authenticated {}", handlerName, credentials);

            Principal p = d.getCredentialsToPrincipalResolver().resolvePrincipal(credentials);

            return new Pair<AuthenticationHandler, Principal>(d.getAuthenticationHandler(), p);
        }
开发者ID:CSharpDev,项目名称:Dev.All,代码行数:35,代码来源:DirectMappingAuthenticationManagerImpl.cs

示例2: populateAttributes

        public Authentication populateAttributes(Authentication authentication, Credentials credentials)
        {

            string credentialsClass = credentials.GetType().FullName;
            string authenticationMethod = this.authenticationMethods.First(x => x.Key == credentialsClass).Value;

            authentication.getAttributes().Add(ATTRIBUTE_AUTHENTICATION_METHOD, authenticationMethod);

            return authentication;
        }
开发者ID:CSharpDev,项目名称:Dev.All,代码行数:10,代码来源:SamlAuthenticationMetaDataPopulator.cs

示例3: doBind

        //protected Logger logger = LoggerFactory.getLogger(getClass());

        public void doBind(HttpContext context, Credentials credentials)
        {
            HttpRequest request = WebUtils.getHttpServletRequest(context);

            if (this._credentialsBinder != null && this._credentialsBinder.supports(credentials.GetType()))
            {
                this._credentialsBinder.bind(request, credentials);
            }
        }
开发者ID:CSharpDev,项目名称:Dev.All,代码行数:11,代码来源:AuthenticationViaFormAction.cs

示例4: supports

    /**
 * Return true if Credentials are UsernamePasswordCredentials, false
 * otherwise.
 */
    public override bool supports(Credentials credentials)
    {
        return credentials != null
               && typeof(UsernamePasswordCredentials).IsAssignableFrom(credentials
                                                                           .GetType());
    }
开发者ID:CSharpDev,项目名称:Dev.All,代码行数:10,代码来源:UsernamePasswordCredentialsToPrincipalResolver.cs

示例5: supports

    /**
 * @return true if the credentials provided are not null and the credentials
 * are a subclass of (or equal to) HttpBasedServiceCredentials.
 */
    public bool supports(Credentials credentials)
    {
        return credentials != null
               && typeof(HttpBasedServiceCredentials).IsAssignableFrom(credentials
                                                                         .GetType());
    }
开发者ID:CSharpDev,项目名称:Dev.All,代码行数:10,代码来源:HttpBasedServiceCredentialsAuthenticationHandler.cs


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