/** * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). *
* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *
* http://www.apache.org/licenses/LICENSE-2.0 *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.zhongzheng.auth.controller;
import com.wf.captcha.SpecCaptcha;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.zhongzheng.auth.granter.ITokenGranter;
import org.zhongzheng.auth.granter.TokenGranterBuilder;
import org.zhongzheng.auth.granter.TokenParameter;
import org.zhongzheng.auth.utils.TokenUtil;
import org.zhongzheng.auth.config.RedisFactoryConfig;
import org.springframework.data.redis.core.RedisTemplate;
import org.zhongzheng.common.utils.CacheNames;
import org.zhongzheng.common.secure.AuthInfo;
import org.zhongzheng.common.utils.R;
import org.zhongzheng.common.utils.Kv;
import org.zhongzheng.common.utils.Func;
import org.zhongzheng.common.utils.RedisUtil;
import org.zhongzheng.common.utils.WebUtil;
import org.zhongzheng.common.feignclient.zzbusinessuser.entity.UserInfo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.PostConstruct;
import java.io.UnsupportedEncodingException;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
/**
* 认证模块
*
* @author Chill
*/
@RestController
@AllArgsConstructor
@Api(value = "用户授权认证", tags = "授权接口")
public class AuthController {
private RedisUtil redisUtil;
private RedisFactoryConfig rdsFactoryConfig;
@PostConstruct
void afterConstruct(){
System.out.println(" ++++++++++++++++++ AuthController: setConnectionFactory ");
redisUtil.setConnectionFactory(rdsFactoryConfig.connectionFactory());
}
@PostMapping("token")
@ApiOperation(value = "获取认证token", notes = "传入租户ID:tenantId,账号:account,密码:password")
public R