All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.bootx.platform.starter.auth.endpoint.TokenEndpoint Maven / Gradle / Ivy

There is a newer version: 1.3.6.2
Show newest version
package cn.bootx.platform.starter.auth.endpoint;

import cn.bootx.platform.common.core.rest.Res;
import cn.bootx.platform.common.core.rest.ResResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 基础登录退出操作
 *
 * @author xxm
 * @since 2021/7/30
 */
@Tag(name = "认证相关")
@RestController
@RequestMapping("/token")
@AllArgsConstructor
public class TokenEndpoint {

    private final TokenService tokenService;

    @Operation(summary = "普通登录")
    @PostMapping("/login")
    public ResResult login(HttpServletRequest request, HttpServletResponse response) {
        return Res.ok(tokenService.login(request, response));
    }

    @Operation(summary = "退出")
    @PostMapping("/logout")
    public ResResult logout() {
        tokenService.logout();
        return Res.ok();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy