package com.ag.web.api;

import com.ag.secp.platform.jwt.JWTInfo;
import com.ag.secp.platform.jwt.JWTTokenForHS256;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.Map;

/**
 * @description:
 * @author: fengjun
 * @time: 2022/9/1 16:21
 */
@RestController
@RequestMapping("/jwt")
public class JwtController {
    @RequestMapping(value = "/getJwt")
    public String getJwt(@NotNull String username, @NotNull String password) {
        Assert.isTrue("admin".equals(username) && "ps".equals(password),"登录密码错误");
        Map<String, Object> map = new HashMap<>();
        map.put("uid", "000010000");
        return JWTTokenForHS256.createToken(map, 30000000);
    }
    @RequestMapping(value = "/getWater")
    public String getWater(){
        return "give you water";
    }
}
