File tree Expand file tree Collapse file tree
simple-common/src/main/java/top/cadecode/common/util Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -114,4 +114,25 @@ public String getNameFromClaims(JWTClaimsSet claimsSet) throws ParseException {
114114 public List <String > getRolesFromClaims (JWTClaimsSet claimsSet ) throws ParseException {
115115 return claimsSet .getStringListClaim (ROLES_KEY );
116116 }
117+
118+ /**
119+ * 判断时间是否过期
120+ *
121+ * @param expiredDate 最大过期时间
122+ * @return 是否过期
123+ */
124+ public boolean isExpired (Date expiredDate ) {
125+ return expiredDate .getTime () < System .currentTimeMillis ();
126+ }
127+
128+ /**
129+ * 判断时间是否过期
130+ *
131+ * @param startDate 起始时间
132+ * @param expiration 秒数
133+ * @return 是否过期
134+ */
135+ public boolean isExpired (Date startDate , long expiration ) {
136+ return isExpired (new Date (startDate .getTime () + expiration * 1000 ));
137+ }
117138}
You can’t perform that action at this time.
0 commit comments