本文整理汇总了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);
}
示例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;
}
示例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);
}
}
示例4: supports
/**
* Return true if Credentials are UsernamePasswordCredentials, false
* otherwise.
*/
public override bool supports(Credentials credentials)
{
return credentials != null
&& typeof(UsernamePasswordCredentials).IsAssignableFrom(credentials
.GetType());
}
示例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());
}