本文整理汇总了Java中com.sap.security.auth.login.LoginContextFactory类的典型用法代码示例。如果您正苦于以下问题:Java LoginContextFactory类的具体用法?Java LoginContextFactory怎么用?Java LoginContextFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LoginContextFactory类属于com.sap.security.auth.login包,在下文中一共展示了LoginContextFactory类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doGet
import com.sap.security.auth.login.LoginContextFactory; //导入依赖的package包/类
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
String user = request.getRemoteUser();
if (user != null)
{
response.getWriter().println("Hello, " + user);
}
else
{
LoginContext loginContext;
try
{
loginContext = LoginContextFactory.createLoginContext("FORM");
loginContext.login();
response.getWriter().println("Hello, " + request.getRemoteUser());
}
catch (LoginException ex)
{
ex.printStackTrace();
}
}
}
开发者ID:SAP,项目名称:cloud-weatherapp,代码行数:28,代码来源:HelloWorldServlet.java
示例2: logoutUser
import com.sap.security.auth.login.LoginContextFactory; //导入依赖的package包/类
@POST
@Path("logout")
public Response logoutUser() {
logger.debug("Logging out current user...");
try {
LoginContext loginContext = LoginContextFactory.createLoginContext();
loginContext.logout();
return Response.status(Response.Status.OK).build();
} catch (LoginException e) {
logger.error("Problem occured while logging out the current user.", e);
throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
}
}
开发者ID:SAP,项目名称:cloud-ariba-partner-flow-extension-ext,代码行数:16,代码来源:UserResource.java
示例3: logoutUser
import com.sap.security.auth.login.LoginContextFactory; //导入依赖的package包/类
public static void logoutUser(HttpServletRequest httpRequest) throws UserServiceException {
if (httpRequest.getRemoteUser() != null) {
try {
LoginContext loginContext = LoginContextFactory.createLoginContext();
loginContext.logout();
} catch (LoginException e) {
String errorMessage = "Unsuccessful logout.";
LOGGER.error(errorMessage, e);
throw new UserServiceException(errorMessage, e);
}
}
}
开发者ID:SAP,项目名称:cloud-c4c-ticket-duplicate-finder-ext,代码行数:13,代码来源:UserService.java
示例4: doGet
import com.sap.security.auth.login.LoginContextFactory; //导入依赖的package包/类
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// Call logout if the user is logged in
LoginContext loginContext = null;
if (request.getRemoteUser() != null) {
try {
loginContext = LoginContextFactory.createLoginContext();
loginContext.logout();
} catch (LoginException e) {
response.sendRedirect("/");
}
}
response.sendRedirect("/");
}
开发者ID:sapmentors,项目名称:lemonaid,代码行数:17,代码来源:LogoutServlet.java
示例5: logout
import com.sap.security.auth.login.LoginContextFactory; //导入依赖的package包/类
/**
* Used to logout the authenticated user.
*
* @param request
* the request for the authenticated user
* @throws AuthenticatedUserException
*/
public static void logout(HttpServletRequest request) throws AuthenticatedUserException {
if (request.getUserPrincipal() != null) {
try {
LoginContext loginContext = LoginContextFactory.createLoginContext();
loginContext.logout();
} catch (LoginException e) {
LOGGER.error(ERROR_LOGOUT_FAILED_MESSAGE, e);
throw new AuthenticatedUserException();
}
}
}
开发者ID:svilenkomitov,项目名称:Food-Calculator,代码行数:25,代码来源:AuthenticatedUserManager.java
示例6: logout
import com.sap.security.auth.login.LoginContextFactory; //导入依赖的package包/类
private void logout() throws LoginException {
LoginContext loginContext = LoginContextFactory.createLoginContext();
loginContext.logout();
}
开发者ID:SAP,项目名称:cloud-sfsf-benefits-ext,代码行数:5,代码来源:LogoutServlet.java
注:本文中的com.sap.security.auth.login.LoginContextFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论