gpt4 book ai didi

com.xpn.xwiki.user.api.XWikiAuthService类的使用及代码示例

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

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

XWikiAuthService介绍

暂无

代码示例

代码示例来源: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 XWikiUser checkAuth(XWikiContext context) throws XWikiException
{
  return getAuthService().checkAuth(context);
}

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

public void showLogin(XWikiContext context) throws XWikiException
{
  XWikiAuthService authservice = getAuthService(context);
  if (authservice == null)
    super.showLogin(context);
  else {
    try {
      authservice.showLogin(context);
    } catch (Exception e) {
      super.showLogin(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

/**
 * Check authentication from request and set according persitent login information If it fails user is unlogged
 * 
 * @return null if failed, non null XWikiUser if sucess
 * @throws XWikiException
 */
public XWikiUser checkAuth() throws XWikiException
{
  return this.context.getWiki().getAuthService().checkAuth(this.context);
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-security-bridge

/**
 * Show the login page, unless the wiki is configured otherwise.
 * @param context the context
 */
private void showLogin(XWikiContext context)
{
  try {
    if (context.getRequest() != null
      /*
       * We must explicitly check the action from the context, as some templates that are
       * rendered may call checkAccess with different actions (which, strictly speaking is
       * incorrect, those templates should use hasAccessLevel).  In particular, 'menuview.vm'
       * will call checkAccess with action 'view', if the document 'XWiki.XWikiLogin' exists.
       */
      && !LOGIN_ACTION.equals(context.getAction())
      && !context.getWiki().Param("xwiki.hidelogin", "false").equalsIgnoreCase("true")) {
      context.getWiki().getAuthService().showLogin(context);
    }
  } catch (XWikiException e) {
    LOGGER.error("Failed to show login page.", e);
  }
}

代码示例来源: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-core

/**
 * Check authentication from username and password and set according persitent login information If it fails user is
 * unlogged
 * 
 * @param username username to check
 * @param password password to check
 * @param rememberme "1" if you want to remember the login accross navigator restart
 * @return null if failed, non null XWikiUser if sucess
 * @throws XWikiException
 */
public XWikiUser checkAuth(String username, String password, String rememberme) throws XWikiException
{
  return this.context.getWiki().getAuthService().checkAuth(username, password, rememberme, this.context);
}

代码示例来源:origin: org.phenotips/phenotips-security-bridge

@Override
public boolean checkAccess(String action, XWikiDocument doc, XWikiContext context) throws XWikiException
{
  DocumentReference userReference = getCurrentUser(context);
  User user = this.userManager.getUser(userReference != null ? userReference.toString() : null, true);
  boolean result = this.service.hasAccess(user, actionToRight(action), doc.getDocumentReference());
  if (!result && context.getUserReference() == null && !"login".equals(context.getAction())) {
    this.logger.debug("Redirecting unauthenticated user to login, since it have been denied [{}] on [{}].",
      actionToRight(action), doc.getDocumentReference());
    context.getWiki().getAuthService().showLogin(context);
  }
  return result;
}

代码示例来源: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

public XWikiUser checkAuth(XWikiContext context) throws XWikiException
{
  XWikiAuthService authservice = getAuthService(context);
  if (authservice == null)
    return super.checkAuth(context);
  else {
    try {
      return authservice.checkAuth(context);
    } catch (Exception e) {
      return super.checkAuth(context);
    }
  }
}

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

@Override
public boolean checkAccess(String action, XWikiDocument doc, XWikiContext context) throws XWikiException
{
  DocumentReference userReference = getCurrentUser(context);
  User user = this.userManager.getUser(userReference != null ? userReference.toString() : null, true);
  boolean result = this.service.hasAccess(user, actionToRight(action), doc.getDocumentReference());
  if (!result && context.getUserReference() == null && !"login".equals(context.getAction())) {
    this.logger.debug("Redirecting unauthenticated user to login, since it have been denied [{}] on [{}].",
      actionToRight(action), doc.getDocumentReference());
    context.getWiki().getAuthService().showLogin(context);
  }
  return result;
}

代码示例来源: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: com.xpn.xwiki.platform/xwiki-core

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

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

if (context.getRequest() != null) {
      if (!context.getWiki().Param("xwiki.hidelogin", "false").equalsIgnoreCase("true")) {
        context.getWiki().getAuthService().showLogin(context);
if (context.getRequest() != null
  && !context.getWiki().Param("xwiki.hidelogin", "false").equalsIgnoreCase("true")) {
  context.getWiki().getAuthService().showLogin(context);

代码示例来源: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: org.xwiki.platform/xwiki-platform-gwt-api

@Override
public String login(String username, String password, boolean rememberme) throws XWikiGWTException
{
  try {
    XWikiContext context = getXWikiContext();
    XWikiUser user =
      context.getWiki().getAuthService().checkAuth(username, password, rememberme ? "yes" : "no", context);
    if (user == null)
      return "XWiki.XWikiGuest";
    else
      return user.getUser();
  } catch (Exception e) {
    throw getXWikiGWTException(e);
  }
}

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

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

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

XWikiUser xwikiUser = xwiki.getAuthService().checkAuth(xwikiContext);
if (xwikiUser != null) {

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