io.github.nichetoolkit.rest.configure.RestRsaProperties 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.rsa.RsaKey;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* RestRsaProperties
* The rest rsa 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.rsa")
public class RestRsaProperties {
/**
* enabled
* The enabled
field.
*/
private boolean enabled;
/**
* keySize
* {@link java.lang.Integer} The keySize
field.
* @see java.lang.Integer
*/
private Integer keySize = 1024;
/**
* publicKey
* {@link java.lang.String} The publicKey
field.
* @see java.lang.String
*/
private String publicKey;
/**
* privateKey
* {@link java.lang.String} The privateKey
field.
* @see java.lang.String
*/
private String privateKey;
/**
* autoVerify
* The autoVerify
field.
*/
private boolean autoVerify = true;
/**
* RestRsaProperties
* Instantiates a new rest rsa properties.
*/
public RestRsaProperties() {
}
/**
* toRsaKey
* The to rsa key method.
* @return {@link io.github.nichetoolkit.rest.worker.rsa.RsaKey} The to rsa key return object is RsaKey
type.
* @see io.github.nichetoolkit.rest.worker.rsa.RsaKey
*/
public RsaKey toRsaKey() {
RsaKey rsaKey = new RsaKey();
if (GeneralUtils.isEmpty(this.publicKey) && GeneralUtils.isEmpty(this.privateKey)) {
rsaKey = null;
} else {
rsaKey.setPublicKey(this.publicKey);
rsaKey.setPrivateKey(this.privateKey);
rsaKey.setKeySize(this.keySize);
}
return rsaKey;
}
}