001/**
002 * Copyright (c) 2015-2022, Michael Yang 杨福海 (fuhai999@gmail.com).
003 * <p>
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 * <p>
008 * http://www.apache.org/licenses/LICENSE-2.0
009 * <p>
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package io.jboot.support.jwt;
017
018import io.jboot.app.config.annotation.ConfigModel;
019import io.jboot.utils.StrUtil;
020
021/**
022 * @author Michael Yang 杨福海 (fuhai999@gmail.com)
023 * @version V1.0
024 */
025@ConfigModel(prefix = "jboot.web.jwt")
026public class JwtConfig {
027
028    private String httpHeaderName = "Jwt";
029    private String httpParameterKey;
030
031    private String secret;
032
033    /**
034     * 有效期,单位毫秒,
035     * 不配置时,或者 小于等于 0 时,永久有效
036     */
037    private long validityPeriod = 0;
038
039    public String getHttpHeaderName() {
040        return httpHeaderName;
041    }
042
043    public void setHttpHeaderName(String httpHeaderName) {
044        this.httpHeaderName = httpHeaderName;
045    }
046
047    public String getHttpParameterKey() {
048        return httpParameterKey;
049    }
050
051    public void setHttpParameterKey(String httpParameterKey) {
052        this.httpParameterKey = httpParameterKey;
053    }
054
055    public String getSecret() {
056        return secret;
057    }
058
059    public void setSecret(String secret) {
060        this.secret = secret;
061    }
062
063    public long getValidityPeriod() {
064        return validityPeriod;
065    }
066
067    public void setValidityPeriod(long validityPeriod) {
068        this.validityPeriod = validityPeriod;
069    }
070
071    public boolean isConfigOk() {
072        return StrUtil.isNotBlank(secret);
073    }
074
075
076}