robe-admin/src/main/java/io/robe/admin/resources/AuthResource.java
@POST
    @UnitOfWork
    @Path("logout")
    @Timed
    public Response logout(@RobeAuth Credentials credentials, @Context HttpServletRequest request) throws Exception {
        Optional<User> user = userDao.findByUsername(credentials.getUsername());
        if (!user.isPresent()) {
            throw new WebApplicationException(Response.Status.UNAUTHORIZED);
        } else {
            BasicToken.clearPermissionCache(credentials.getUsername());
            user.get().setLastLogoutTime(DateTime.now().toDate());
            logAction(new ActionLog("LOGOUT", null, user.get().toString(), true, request.getRemoteAddr()));
            return Response.ok().header("Set-Cookie", TokenBasedAuthResponseFilter.getTokenSentence(null)).build();
        }
    }
@POST
    @UnitOfWork
    @Path("logout")
    @Timed
    public Response logout(@RobeAuth Credentials credentials, @Context HttpServletRequest request) throws Exception {
        Optional<User> user = userDao.findByUsername(credentials.getUsername());
        if (!user.isPresent()) {
            throw new WebApplicationException(Response.Status.UNAUTHORIZED);
        } else {
            BasicToken.clearPermissionCache(credentials.getUsername());
            user.get().setLastLogoutTime(DateTime.now().toDate());
            logAction(new ActionLog("LOGOUT", null, user.get().toString(), true, request.getRemoteAddr()));
            return Response.ok().header("Set-Cookie", TokenBasedAuthResponseFilter.getTokenSentence(null)).build();
        }
    }
@ POST @ UnitOfWork @ Path ( "logout" ) @ Timed public Response logout ( @ RobeAuth Credentials credentials , @ Context HttpServletRequest request ) throws Exception { Optional < User > user = userDao . findByUsername ( credentials . getUsername ( ) ) ; if ( ! user . isPresent ( ) ) { throw new WebApplicationException ( Response . Status . UNAUTHORIZED ) ; } else { BasicToken . clearPermissionCache ( credentials . getUsername ( ) ) ; user . get ( ) . setLastLogoutTime ( DateTime . now ( ) . toDate ( ) ) ; logAction ( new ActionLog ( "LOGOUT" , null , user . get ( ) . toString ( ) , true , request . getRemoteAddr ( ) ) ) ; return Response . ok ( ) . header ( "Set-Cookie" , TokenBasedAuthResponseFilter . getTokenSentence ( null ) ) . build ( ) ; } }
Log out

@param credentials injected by {@link RobeAuth} annotation for authentication.
@return {@link User} when logout
@throws Exception for clear permission cache
Log out