io.github.nichetoolkit.rest.configure.RestShaProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rest-toolkit-utils Show documentation
Show all versions of rest-toolkit-utils Show documentation
Rest toolkit utils project for Spring Boot
The newest version!
package io.github.nichetoolkit.rest.configure;
import io.github.nichetoolkit.rest.util.GeneralUtils;
import io.github.nichetoolkit.rest.worker.RadixWorker;
import io.github.nichetoolkit.rest.worker.sha.ShaAlgorithm;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* RestShaProperties
* The rest sha properties class.
* @author Cyan ([email protected])
* @see lombok.Getter
* @see lombok.Setter
* @see org.springframework.stereotype.Component
* @see org.springframework.boot.context.properties.ConfigurationProperties
* @since Jdk1.8
*/
@Getter
@Setter
@Component
@ConfigurationProperties(prefix = "nichetoolkit.rest.sha")
public class RestShaProperties {
/**
* enabled
* The enabled
field.
*/
private boolean enabled;
/**
* secret
* {@link java.lang.String} The secret
field.
* @see java.lang.String
*/
private String secret;
/**
* algorithm
* {@link io.github.nichetoolkit.rest.worker.sha.ShaAlgorithm} The algorithm
field.
* @see io.github.nichetoolkit.rest.worker.sha.ShaAlgorithm
*/
private ShaAlgorithm algorithm = ShaAlgorithm.SHA256;
/**
* RestShaProperties
* Instantiates a new rest sha properties.
*/
public RestShaProperties() {
}
/**
* getSecret
* The get secret getter method.
* @return {@link java.lang.String} The get secret return object is String
type.
* @see java.lang.String
*/
public String getSecret() {
if (GeneralUtils.isEmpty(this.secret)) {
return secret = RadixWorker.encrypts(System.currentTimeMillis());
}
return secret;
}
}