1:什么是Token?:三部分组成:头+有效负载+签名

1.1 JWT创建中的一些方法讲解:

 public static String createTokenWithClaim(User user){//构建头部信息Map<String,Object> map = new HashMap<>();map.put("typ","JWT");map.put("alg","HS256");//构建密钥信息。使用自定义token密钥还是用户密码都可以,选择不一样,在解密的时候会不一样。一般建议自定义,安全、方便Algorithm algorithm = Algorithm.HMAC256(TOKEN_SECRET);    //使用自定义的token密钥
//        Algorithm algorithm = Algorithm.HMAC256(user.getRead_userpass());   //使用用户输入的用户密码作为密钥//通过自定义声明并组合头部细腻些和密钥信息生成jwt tokenDate nowDate = new Date();Date expireDate = new Date(System.currentTimeMillis() + EXPIRE_TIME);   //过期时间预处理String token = JWT.create().withHeader(map).withClaim("loginName",user.getRead_username()) //自定义,登录用户名.withClaim("deptName","技术部")    //自定义,部门.withClaim("loginPass",user.getRead_userpass()) //自定义,登录用户密码.withIssuer("SERVICE") // 声明,签名是有谁生成 例如 服务器.withSubject("this is test token") //声明, 签名的主题// .withNotBefore(new Date()) //声明,定义在什么时间之前,该jwt都是不可用的.withAudience("APP") //声明, 签名的观众 也可以理解谁接受签名的.withIssuedAt(nowDate) //声明, 生成签名的时间.withExpiresAt(expireDate)//声明, 签名过期的时间.sign(algorithm);   //签名signaturereturn token;}

1.2: JWT解密中的一些方法讲解:

  /*** 验证jwt token* 如果在生成token的步奏中构建密钥信息使用了用户密码,则在解密的时候,同样构建密钥信息的时候需要用户密码*/public static void verifyToken(String token){//构建密钥信息Algorithm algorithm = Algorithm.HMAC256(TOKEN_SECRET);//通过密钥信息和签名的发布者的信息生成JWTVerifier(JWT验证类)。不提那家发布者的信息也可以获取JWTVerifierJWTVerifier verifier = JWT.require(algorithm)
//                .withIssuer("SERVICE")  //不添加.withIssuer("SERVICE") 也可以获取JWTVerifier.build();//通过JWTVerifier获取token中的信息DecodedJWT jwt = verifier.verify(token);//获取token中的声明和自定义声明String subject = jwt.getSubject();List<String> audience = jwt.getAudience();Map<String, Claim> claims = jwt.getClaims();for (Map.Entry<String, Claim> entry : claims.entrySet()){String key = entry.getKey();Claim claim = entry.getValue();String value = claim.asString();System.out.println("key:"+key+" value:"+claim.asString());}}}

2:Springboot+JWT+Redis实现登陆登出功能

2.1:首先我们在pom引入redis:

   <!--  JWT  --><dependency><groupId>com.auth0</groupId><artifactId>java-jwt</artifactId><version>3.4.0</version></dependency><!--  Redis依赖   --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId><!-- 1.5的版本默认采用的连接池技术是jedis  2.0以上版本默认连接池是lettuce, 在这里采用jedis,所以需要排除lettuce的jar --><exclusions><exclusion><groupId>redis.clients</groupId><artifactId>jedis</artifactId></exclusion><exclusion><groupId>io.lettuce</groupId><artifactId>lettuce-core</artifactId></exclusion></exclusions></dependency><!-- 添加jedis客户端 --><dependency><groupId>redis.clients</groupId><artifactId>jedis</artifactId><version>2.9.0</version></dependency><!--spring2.0集成redis所需common-pool2--><!-- 必须加上,jedis依赖此  --><!-- spring boot 2.0 的操作手册有标注 大家可以去看看 地址是:https://docs.spring.io/spring-boot/docs/2.0.3.RELEASE/reference/htmlsingle/--><dependency><groupId>org.apache.commons</groupId><artifactId>commons-pool2</artifactId><version>RELEASE</version></dependency>

2.2:在application.yml中配置:

  redis:# Redis服务器地址host: 127.0.0.1# Redis数据库索引(默认为0)database: 0# Redis服务器连接端口port: 6379password:#连接超时时间(毫秒)timeout: 3600

2.3:基础的BaseRedisConfig配置类,序列化:

package com.example.common;import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.interceptor.KeyGenerator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheConfiguration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializationContext;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;import java.lang.reflect.Method;
import java.time.Duration;@Configuration
@EnableCaching
public class BaseRedisConfig {/*** 自定义key规则* @return*/@Beanpublic KeyGenerator keyGenerator() {return new KeyGenerator() {@Overridepublic Object generate(Object target, Method method, Object... params) {StringBuilder sb = new StringBuilder();sb.append(target.getClass().getName());sb.append(method.getName());for (Object obj : params) {sb.append(obj.toString());}return sb.toString();}};}/*** 设置RedisTemplate规则* @param redisConnectionFactory* @return*/@Beanpublic RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>();redisTemplate.setConnectionFactory(redisConnectionFactory);Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);//解决查询缓存转换异常的问题ObjectMapper om = new ObjectMapper();// 指定要序列化的域,field,get和set,以及修饰符范围,ANY是都有包括private和publicom.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);// 指定序列化输入的类型,类必须是非final修饰的,final修饰的类,比如String,Integer等会跑出异常om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);jackson2JsonRedisSerializer.setObjectMapper(om);//序列号key valueredisTemplate.setKeySerializer(new StringRedisSerializer());redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);redisTemplate.setHashKeySerializer(new StringRedisSerializer());redisTemplate.setHashValueSerializer(jackson2JsonRedisSerializer);redisTemplate.afterPropertiesSet();return redisTemplate;}/*** 设置CacheManager缓存规则* @param factory* @return*/@Beanpublic CacheManager cacheManager(RedisConnectionFactory factory) {RedisSerializer<String> redisSerializer = new StringRedisSerializer();Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);//解决查询缓存转换异常的问题ObjectMapper om = new ObjectMapper();om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);jackson2JsonRedisSerializer.setObjectMapper(om);// 配置序列化(解决乱码的问题),过期时间600秒RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofSeconds(600)).serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(redisSerializer)).serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(jackson2JsonRedisSerializer)).disableCachingNullValues();RedisCacheManager cacheManager = RedisCacheManager.builder(factory).cacheDefaults(config).build();return cacheManager;}
}

2.4:对redis中的redisTemplate封装:(接口和实现类)

package com.example.service;
import org.springframework.data.domain.Sort;
import org.springframework.data.geo.Distance;
import org.springframework.data.geo.GeoResults;
import org.springframework.data.geo.Point;
import org.springframework.data.redis.connection.RedisGeoCommands;import java.util.List;
import java.util.Map;
import java.util.Set;/*** ClassName: RedisService <br/>* Description: redis操作接口 <br/>*/
public interface RedisService {/*** 保存属性** @param key   key值* @param value value值* @param time  时间戳*/void set(String key, Object value, long time);/*** 保存属性** @param key   key值* @param value value值*/void set(String key, Object value);/*** 获取属性** @param key key值* @return 返回对象*/Object get(String key);/*** 删除属性** @param key key值* @return 返回成功*/Boolean del(String key);/*** 批量删除属性** @param keys key值集合* @return 返回删除数量*/Long del(List<String> keys);/*** 设置过期时间** @param key  key值* @param time 时间戳* @return 返回成功*/Boolean expire(String key, long time);/*** 获取过期时间** @param key key值* @return 返回时间戳*/Long getExpire(String key);/*** 判断key是否存在** @param key key值* @return 返回*/Boolean hasKey(String key);/*** 按delta递增** @param key   key值* @param delta delta值* @return 返回递增后结果*/Long incr(String key, long delta);/*** 按delta递减** @param key   key值* @param delta delta值* @return 返回递减后结果*/Long decr(String key, long delta);/*** 获取Hash结构中的属性** @param key     外部key值* @param hashKey 内部key值* @return 返回内部key的value*/Object hGet(String key, String hashKey);/*** 向Hash结构中放入一个属性** @param key     外部key* @param hashKey 内部key* @param value   内部key的value* @param time    过期时间* @return 返回是否成功*/Boolean hSet(String key, String hashKey, Object value, long time);/*** 向Hash结构中放入一个属性** @param key     外部key* @param hashKey 内部key* @param value   内部key的value*/void hSet(String key, String hashKey, Object value);/*** 直接获取整个Hash结构** @param key 外部key值* @return 返回hashMap*/Map<Object, Object> hGetAll(String key);/*** 直接设置整个Hash结构** @param key  外部key* @param map  hashMap值* @param time 过期时间* @return 返回是否成功*/Boolean hSetAll(String key, Map<String, Object> map, long time);/*** 直接设置整个Hash结构** @param key 外部key* @param map hashMap值*/void hSetAll(String key, Map<String, ?> map);/*** 删除Hash结构中的属性** @param key     外部key值* @param hashKey 内部key值*/void hDel(String key, Object... hashKey);/*** 判断Hash结构中是否有该属性** @param key     外部key* @param hashKey 内部key* @return 返回是否存在*/Boolean hHasKey(String key, String hashKey);/*** Hash结构中属性递增** @param key     外部key* @param hashKey 内部key* @param delta   递增条件* @return 返回递增后的数据*/Long hIncr(String key, String hashKey, Long delta);/*** Hash结构中属性递减** @param key     外部key* @param hashKey 内部key* @param delta   递增条件* @return 返回递减后的数据*/Long hDecr(String key, String hashKey, Long delta);/*** 获取Set结构** @param key key* @return 返回set集合*/Set<Object> sMembers(String key);/*** 向Set结构中添加属性** @param key    key* @param values value集* @return 返回增加数量*/Long sAdd(String key, Object... values);/*** 向Set结构中添加属性** @param key    key* @param time   过期时间* @param values 值集合* @return 返回添加的数量*/Long sAdd(String key, long time, Object... values);/*** 是否为Set中的属性** @param key   key* @param value value* @return 返回是否存在*/Boolean sIsMember(String key, Object value);/*** 获取Set结构的长度** @param key key* @return 返回长度*/Long sSize(String key);/*** 删除Set结构中的属性** @param key    key* @param values value集合* @return 删除掉的数据量*/Long sRemove(String key, Object... values);/*** 获取List结构中的属性** @param key   key* @param start 开始* @param end   结束* @return 返回查询的集合*/List<Object> lRange(String key, long start, long end);/*** 获取List结构的长度** @param key key* @return 长度*/Long lSize(String key);/*** 根据索引获取List中的属性** @param key   key* @param index 索引* @return 对象*/Object lIndex(String key, long index);/*** 向List结构中添加属性** @param key   key* @param value value* @return 增加后的长度*/Long lPush(String key, Object value);/*** 向List结构中添加属性** @param key   key* @param value value* @param time  过期时间* @return 增加后的长度*/Long lPush(String key, Object value, long time);/*** 向List结构中批量添加属性** @param key    key* @param values value 集合* @return 增加后的长度*/Long lPushAll(String key, Object... values);/*** 向List结构中批量添加属性** @param key    key* @param time   过期时间* @param values value集合* @return 增加后的长度*/Long lPushAll(String key, Long time, Object... values);/*** 从List结构中移除属性** @param key   key* @param count 总量* @param value value* @return 返回删除后的长度*/Long lRemove(String key, long count, Object value);/*** 向bitmap中新增值** @param key    key* @param offset 偏移量* @param b      状态* @return 结果*/Boolean bitAdd(String key, int offset, boolean b);/*** 从bitmap中获取偏移量的值** @param key    key* @param offset 偏移量* @return 结果*/Boolean bitGet(String key, int offset);/*** 获取bitmap的key值总和** @param key key* @return 总和*/Long bitCount(String key);/*** 获取bitmap范围值** @param key    key* @param limit  范围* @param offset 开始偏移量* @return long类型集合*/List<Long> bitField(String key, int limit, int offset);/*** 获取所有bitmap** @param key key* @return 以二进制字节数组返回*/byte[] bitGetAll(String key);/*** 增加坐标** @param key  key* @param x    x* @param y    y* @param name 地点名称* @return 返回结果*/Long geoAdd(String key, Double x, Double y, String name);/*** 根据城市名称获取坐标集合** @param key   key* @param place 地点* @return 坐标集合*/List<Point> geoGetPointList(String key, Object... place);/*** 计算两个城市之间的距离** @param key      key* @param placeOne 地点1* @param placeTow 地点2* @return 返回距离*/Distance geoCalculationDistance(String key, String placeOne, String placeTow);/*** 获取附该地点附近的其他地点** @param key      key* @param place    地点* @param distance 附近的范围* @param limit    查几条* @param sort     排序规则* @return 返回附近的地点集合*/GeoResults<RedisGeoCommands.GeoLocation<Object>> geoNearByPlace(String key, String place, Distance distance, long limit, Sort.Direction sort);/*** 获取地点的hash** @param key   key* @param place 地点* @return 返回集合*/List<String> geoGetHash(String key, String... place);
}

2.5:RedisServiceImpl

package com.example.service.impl;
import com.example.service.RedisService;
import org.springframework.data.domain.Sort;
import org.springframework.data.geo.Distance;
import org.springframework.data.geo.GeoResults;
import org.springframework.data.geo.Point;
import org.springframework.data.redis.connection.BitFieldSubCommands;
import org.springframework.data.redis.connection.RedisGeoCommands;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;/*** ClassName: RedisServiceImpl <br/>* Description: redis操作的具体时间类 <br/>*/
@Service
public class RedisServiceImpl implements RedisService {@Resourceprivate RedisTemplate<String, Object> redisTemplate;@Overridepublic void set(String key, Object value, long time) {redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);}@Overridepublic void set(String key, Object value) {redisTemplate.opsForValue().set(key, value);}@Overridepublic Object get(String key) {return redisTemplate.opsForValue().get(key);}@Overridepublic Boolean del(String key) {return redisTemplate.delete(key);}@Overridepublic Long del(List<String> keys) {return redisTemplate.delete(keys);}@Overridepublic Boolean expire(String key, long time) {return redisTemplate.expire(key, time, TimeUnit.SECONDS);}@Overridepublic Long getExpire(String key) {return redisTemplate.getExpire(key, TimeUnit.SECONDS);}@Overridepublic Boolean hasKey(String key) {return redisTemplate.hasKey(key);}@Overridepublic Long incr(String key, long delta) {return redisTemplate.opsForValue().increment(key, delta);}@Overridepublic Long decr(String key, long delta) {return redisTemplate.opsForValue().increment(key, -delta);}@Overridepublic Object hGet(String key, String hashKey) {return redisTemplate.opsForHash().get(key, hashKey);}@Overridepublic Boolean hSet(String key, String hashKey, Object value, long time) {redisTemplate.opsForHash().put(key, hashKey, value);return expire(key, time);}@Overridepublic void hSet(String key, String hashKey, Object value) {redisTemplate.opsForHash().put(key, hashKey, value);}@Overridepublic Map<Object, Object> hGetAll(String key) {return redisTemplate.opsForHash().entries(key);}@Overridepublic Boolean hSetAll(String key, Map<String, Object> map, long time) {redisTemplate.opsForHash().putAll(key, map);return expire(key, time);}@Overridepublic void hSetAll(String key, Map<String, ?> map) {redisTemplate.opsForHash().putAll(key, map);}@Overridepublic void hDel(String key, Object... hashKey) {redisTemplate.opsForHash().delete(key, hashKey);}@Overridepublic Boolean hHasKey(String key, String hashKey) {return redisTemplate.opsForHash().hasKey(key, hashKey);}@Overridepublic Long hIncr(String key, String hashKey, Long delta) {return redisTemplate.opsForHash().increment(key, hashKey, delta);}@Overridepublic Long hDecr(String key, String hashKey, Long delta) {return redisTemplate.opsForHash().increment(key, hashKey, -delta);}@Overridepublic Set<Object> sMembers(String key) {return redisTemplate.opsForSet().members(key);}@Overridepublic Long sAdd(String key, Object... values) {return redisTemplate.opsForSet().add(key, values);}@Overridepublic Long sAdd(String key, long time, Object... values) {Long count = redisTemplate.opsForSet().add(key, values);expire(key, time);return count;}@Overridepublic Boolean sIsMember(String key, Object value) {return redisTemplate.opsForSet().isMember(key, value);}@Overridepublic Long sSize(String key) {return redisTemplate.opsForSet().size(key);}@Overridepublic Long sRemove(String key, Object... values) {return redisTemplate.opsForSet().remove(key, values);}@Overridepublic List<Object> lRange(String key, long start, long end) {return redisTemplate.opsForList().range(key, start, end);}@Overridepublic Long lSize(String key) {return redisTemplate.opsForList().size(key);}@Overridepublic Object lIndex(String key, long index) {return redisTemplate.opsForList().index(key, index);}@Overridepublic Long lPush(String key, Object value) {return redisTemplate.opsForList().rightPush(key, value);}@Overridepublic Long lPush(String key, Object value, long time) {Long index = redisTemplate.opsForList().rightPush(key, value);expire(key, time);return index;}@Overridepublic Long lPushAll(String key, Object... values) {return redisTemplate.opsForList().rightPushAll(key, values);}@Overridepublic Long lPushAll(String key, Long time, Object... values) {Long count = redisTemplate.opsForList().rightPushAll(key, values);expire(key, time);return count;}@Overridepublic Long lRemove(String key, long count, Object value) {return redisTemplate.opsForList().remove(key, count, value);}@Overridepublic Boolean bitAdd(String key, int offset, boolean b) {return redisTemplate.opsForValue().setBit(key, offset, b);}@Overridepublic Boolean bitGet(String key, int offset) {return redisTemplate.opsForValue().getBit(key, offset);}@Overridepublic Long bitCount(String key) {return redisTemplate.execute((RedisCallback<Long>) con -> con.bitCount(key.getBytes()));}@Overridepublic List<Long> bitField(String key, int limit, int offset) {return redisTemplate.execute((RedisCallback<List<Long>>) con ->con.bitField(key.getBytes(),BitFieldSubCommands.create().get(BitFieldSubCommands.BitFieldType.unsigned(limit)).valueAt(offset)));}@Overridepublic byte[] bitGetAll(String key) {return redisTemplate.execute((RedisCallback<byte[]>) con -> con.get(key.getBytes()));}@Overridepublic Long geoAdd(String key, Double x, Double y, String name) {return redisTemplate.opsForGeo().add(key, new Point(x, y), name);}@Overridepublic List<Point> geoGetPointList(String key, Object... place) {return redisTemplate.opsForGeo().position(key, place);}@Overridepublic Distance geoCalculationDistance(String key, String placeOne, String placeTow) {return redisTemplate.opsForGeo().distance(key, placeOne, placeTow, RedisGeoCommands.DistanceUnit.KILOMETERS);}@Overridepublic GeoResults<RedisGeoCommands.GeoLocation<Object>> geoNearByPlace(String key, String place, Distance distance, long limit, Sort.Direction sort) {RedisGeoCommands.GeoRadiusCommandArgs args = RedisGeoCommands.GeoRadiusCommandArgs.newGeoRadiusArgs().includeDistance().includeCoordinates();// 判断排序方式if (Sort.Direction.ASC == sort) {args.sortAscending();} else {args.sortDescending();}args.limit(limit);return redisTemplate.opsForGeo().radius(key, place, distance, args);}@Overridepublic List<String> geoGetHash(String key, String... place) {return redisTemplate.opsForGeo().hash(key, place);}}

2.6:登录接口填写:

  /*** 登录** @param user* @return*/@PostMapping("/login")public Result<User> login(@RequestBody User user) {User res = userService.login(user);//判断该用户是否已经登陆:if (redisService.get(user.getUsername())==null){// 生成tokenString token = JWT.create().withAudience(res.getUsername()).sign(Algorithm.HMAC256(res.getPassword()));res.setToken(token);logService.log(user.getUsername(), StrUtil.format("用户 {} 登录系统", user.getUsername()));//将token存入redis缓存中:redisService.set(res.getUsername(),token,1800);return Result.success(res);}else {return  Result.error("500","你已在其他设备登陆");}}

2.7:登出接口填写:

 /*** 退出登录*/@DeleteMappingpublic  Result<?> loginOut(HttpServletRequest request){String token = request.getHeader("token");String username = JWT.decode(token).getAudience().get(0);redisService.del(username);return Result.success("退出成功");}

2.8:拦截器:

package com.example.common;import cn.hutool.core.util.StrUtil;
import com.auth0.jwt.JWT;
import com.auth0.jwt.JWTVerifier;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.exceptions.JWTDecodeException;
import com.auth0.jwt.exceptions.JWTVerificationException;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.example.entity.User;
import com.example.exception.CustomException;
import com.example.service.RedisService;
import com.example.service.UserService;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;/*** 拦截器*/
public class AuthInterceptor implements HandlerInterceptor {@Resourceprivate UserService userService;@Resourceprivate RedisService redisService;@Overridepublic boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {String token = request.getHeader("token");if (StrUtil.isBlank(token)) {throw new CustomException("401", "未获取到token, 请重新登录");}String username;try {username = JWT.decode(token).getAudience().get(0);} catch (JWTDecodeException j) {throw new CustomException("401", "权限验证失败, 请重新登录");}if (redisService.get(username)==null){throw new CustomException("401", "token已过期");}// 拿到的token跟redis里面的做比对,看有没有过期if (redisService.get(username).equals(token)){User user = userService.getOne(Wrappers.<User>lambdaQuery().eq(User::getUsername, username));if (user == null) {throw new CustomException("401", "用户不存在, 请重新登录");}// 验证 tokenJWTVerifier jwtVerifier = JWT.require(Algorithm.HMAC256(user.getPassword())).build();try {jwtVerifier.verify(token);} catch (JWTVerificationException e) {throw new CustomException("401", "token不合法, 请重新登录");}return true;}throw new CustomException("401", "token不一致");}}

Springboot+JWT+Redis实现登陆登出功能相关推荐

  1. 淘东电商项目(27) -门户登出功能

    引言 本文代码已提交至Github(版本号:42c2ed4af58dac7388e399a1f3606baf4c57744e),有兴趣的同学可以下载来看看:https://github.com/ylw ...

  2. Springboot整合SpringSecurity 04-启用登出logout功能

    Springboot整合SpringSecurity 04-启用登出logout功能 前面Springboot整合SpringSecurity 02-使用自定义登陆页面我们讲过了SpringSecur ...

  3. [django项目] 实现用户登录登出功能

    用户登录登出功能 I. 功能需求分析 1>功能分析 1.1>流程图 1.2>功能接口 登录页面 登录功能 退出功能 II. 登陆页面 1>接口设计 1.1>接口说明 类目 ...

  4. 单点登录cas-4.0.0 只是简单的同时登入,同时登出功能

    什么是单点登录 单点登录(Single Sign On),简称为 SSO,是目前比较流行的企业业务整合的解决方案之一.SSO的定义是在多个应用系统中,用户只需要登录一次就可以访问所有相互信任的应用系统 ...

  5. 通过session实现用户的登录与登出功能

    通过session实现用户的登录与登出功能 本文讲解,就是在常见的登录注册页面中,我们是如何在登录之后,把用户的信息传送到后面的网页. 首先讲解原理,原理是session功能,通过session的在当 ...

  6. vue-admin-实现登出功能

    实现登出功能 目标:实现用户的登出操作 登出仅仅是跳到登录页吗? 不,当然不是,我们要处理如下 同样的,登出功能,我们在vuex中的用户模块中实现对应的action 登出action src/stor ...

  7. php 登录 登出,个人博客—用户登陆登出

    个人博客-用户登陆&登出 点击头部的登陆按钮,弹出用户登录dialog 用户登录dialog 输入用户名和密码会验证是否符合要求,不符合则在上面提示错误信息,且将对应的表单元素边框和必填标志变 ...

  8. node+mysql+vue-element-admin,前后端联动,md5加密,jwt验证,登录登出

    后端登录 搭建http服务 搭建https服务的话:搭建https服务 http服务我们前面其实已经搭好了 现在把端口换一下 18082 因为访问47.103.29.206:18082的话会报错,因为 ...

  9. SpringBoot + JWT + Redis 开源知识社区系统

    「Java学习+面试指南」一份涵盖大部分 Java 程序员所需要掌握的核心知识.准备 Java 面试,首选 JavaGuide!:https://javaguide.cn/ 你好,我是 Guide!这 ...

最新文章

  1. 使用CoreLocation进行定位(Swift版)
  2. Xamarin中VS无法连接Mac系统的解决办法
  3. JAVAAPI之STRING类和STRINGBUFER类
  4. 【专升本计算机】2021年甘肃省专升本计算机全真模拟试题(五)
  5. 关于ubuntu 是否需要使用std::到问题。
  6. 2021 年软件工程现状:Python 或将成为第一大编程语言,中国开源涨势最猛
  7. MQTT(1)---物联网核心之MQTT(一)
  8. Android studio 真机调试出现sdk版本不匹配问题
  9. exe变计算机病毒,文件夹变exe病毒怎么恢复 文件夹exe病毒的解决方法
  10. cad2020打印样式放在哪个文件夹_CAD图形打印相关问题!
  11. WinPE启动映像制作(具体可参考WAIK帮助文档,这里只做简介)WinPe Image 制作篇
  12. UE4 Runtime下导入IES贴图为TextureLightProfile
  13. win10解决部分应用字体模糊的问题
  14. 如何在旋转屏幕后不再重建Activity
  15. 数据重生:让神经机器翻译中的不活跃样本“复活”
  16. 解决:Android中常见的热门标签的流式布局flowlayout不能wrap_content
  17. 独家 | 维信金科申请消费金融牌照未果
  18. 【人脸识别项目一】:眨眼检测
  19. ps cs6更新服务器无响应,photoshop cs6打开无响应或者不能打开图片文件最全解决办法...
  20. Ubuntu16.04 (ROS)下通过CAN分析仪(USBCAN/CANalyst-II)调试无人车助力转向电机(1)

热门文章

  1. c语言位运算(c语言回文数编程)
  2. 在mac中怎么显示隐藏文件夹
  3. Sublime merge汉化教程(亲测可用)
  4. sublime 各种插件使用
  5. 西安电子科技大学通院811电院821考研上岸经验分享(三)
  6. srcset_如何使用srcset构建响应图像
  7. matplotlib 子图 画奇数个
  8. 文本框阴影怎么去掉html,关于html:删除文本输入的内部阴影
  9. C语言编程之输出指定的字符
  10. 云栖盘点:2022 云网络产业干货分享