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

org.apache.shiro.spring.boot.jwt.JwtPayload Maven / Gradle / Ivy

/*
 * Copyright (c) 2018, vindell (https://github.com/vindell).
 *
 * 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.apache.shiro.spring.boot.jwt;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.google.common.collect.Maps;

/**
 * TODO
 * @author : vindell
 */
public class JwtPayload {

	private String tokenId;// 令牌id
	private String clientId;// 客户标识(用户名、账号)
	private String issuer;// 签发者(JWT令牌此项有值)
	private Date issuedAt;// 签发时间
	private Date expiration;// 过期时间
	private Date notBefore;// not-before 时间
	private List audience;// 接收方(JWT令牌此项有值)
	private Map claims;// 访问主张(JWT令牌此项有值)
	private String host;// 客户地址

	public String getTokenId() {
		return tokenId;
	}

	public void setTokenId(String tokenId) {
		this.tokenId = tokenId;
	}

	public String getClientId() {
		return clientId;
	}

	public void setClientId(String clientId) {
		this.clientId = clientId;
	}

	public String getIssuer() {
		return issuer;
	}

	public void setIssuer(String issuer) {
		this.issuer = issuer;
	}

	public Date getIssuedAt() {
		return issuedAt;
	}

	public void setIssuedAt(Date issuedAt) {
		this.issuedAt = issuedAt;
	}
	
	public Date getExpiration() {
		return expiration;
	}

	public void setExpiration(Date expiration) {
		this.expiration = expiration;
	}

	public Date getNotBefore() {
		return notBefore;
	}

	public void setNotBefore(Date notBefore) {
		this.notBefore = notBefore;
	}

	public List getAudience() {
		return audience;
	}

	public void setAudience(List audience) {
		this.audience = audience;
	}

	public Map getClaims() {
		return claims == null ? Maps.newHashMap() : claims;
	}

	public void setClaims(Map claims) {
		this.claims = claims;
	}

	public String getRoles() {
		return String.valueOf(getClaims().get("roles"));
	}

	public String getPerms() {
		return String.valueOf(getClaims().get("perms"));
	}

	public String getHost() {
		return host;
	}

	public void setHost(String host) {
		this.host = host;
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy