gpt4 book ai didi

com.xpn.xwiki.user.api.XWikiAuthService.authenticate()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 03:48:40 26 4
gpt4 key购买 nike

本文整理了Java中com.xpn.xwiki.user.api.XWikiAuthService.authenticate()方法的一些代码示例,展示了XWikiAuthService.authenticate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XWikiAuthService.authenticate()方法的具体详情如下:
包路径:com.xpn.xwiki.user.api.XWikiAuthService
类名称:XWikiAuthService
方法名:authenticate

XWikiAuthService.authenticate介绍

暂无

代码示例

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

public static Principal authenticate(String username, String password, XWikiContext context) throws XWikiException
{
  return context.getWiki().getAuthService().authenticate(username, password, context);
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

public static Principal authenticate(String username, String password, XWikiContext context) throws XWikiException
{
  return context.getWiki().getAuthService().authenticate(username, password, context);
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

public Principal authenticate(String username, String password, XWikiContext context) throws XWikiException
{
  XWikiAuthService authservice = getAuthService(context);
  if (authservice == null)
    return super.authenticate(username, password, context);
  else {
    try {
      return authservice.authenticate(username, password, context);
    } catch (Exception e) {
      return super.authenticate(username, password, context);
    }
  }
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-rest-server

@Override
public boolean checkSecret(Request request, String identifier, char[] secret)
{
  ComponentManager componentManager =
    (ComponentManager) getContext().getAttributes().get(Constants.XWIKI_COMPONENT_MANAGER);
  XWikiContext xwikiContext = Utils.getXWikiContext(componentManager);
  XWiki xwiki = Utils.getXWiki(componentManager);
  try {
    Principal principal = xwiki.getAuthService().authenticate(identifier, new String(secret), xwikiContext);
    if (principal != null) {
      String xwikiUser = principal.getName();
      xwikiContext.setUser(xwikiUser);
      getLogger().log(Level.FINE, String.format("Authenticated as '%s'.", identifier));
      return true;
    }
  } catch (XWikiException e) {
    getLogger().log(Level.WARNING, "Exception occurred while authenticating.", e);
  }
  getLogger().log(Level.WARNING, String.format("Cannot authenticate '%s'.", identifier));
  return false;
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

/**
 * Login.
 * 
 * @return A token to be used in subsequent calls as an identification.
 * @throws Exception If authentication fails.
 */
public String login(String userName, String password) throws Exception
{
  String token;
  Principal principal = this.xwiki.getAuthService().authenticate(userName, password, this.xwikiContext);
  if (principal != null) {
    // Generate "unique" token using a random number
    token = this.xwiki.generateValidationKey(128);
    String ip = this.xwikiContext.getRequest().getRemoteAddr();
    XWikiUtils.getTokens(this.xwikiContext).put(token, new XWikiXmlRpcUser(principal.getName(), ip));
    return token;
  } else {
    throw new Exception(String.format("[Authentication failed for user '%s']", userName));
  }
}

代码示例来源:origin: org.phenotips/patient-data-sharing-receiver-api

String password = request.getParameter(ShareProtocol.CLIENT_POST_KEY_NAME_PASSWORD);
if (context.getWiki().getAuthService().authenticate(userName, password, context) == null) {
  return generateFailedCredentialsResponse();

代码示例来源:origin: phenotips/phenotips

String password = request.getParameter(ShareProtocol.CLIENT_POST_KEY_NAME_PASSWORD);
if (context.getWiki().getAuthService().authenticate(userName, password, context) == null) {
  return generateFailedCredentialsResponse();

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com