Class AuthConfig
java.lang.Object
org.summerboot.jexpress.boot.config.BootConfig
org.summerboot.jexpress.security.auth.AuthConfig
- All Implemented Interfaces:
JExpressConfig
- Author:
- Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
-
Nested Class Summary
Nested classes/interfaces inherited from class org.summerboot.jexpress.boot.config.BootConfig
BootConfig.ThreadingMode -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Stringstatic final AuthConfigprotected static final Stringprotected static final Stringprotected Stringprotected io.jsonwebtoken.JwtParserprotected Keyprotected intprotected static final Stringprotected static final Stringprotected static final Stringprotected KeyManagerFactoryprotected Stringprotected Propertiesprotected Stringprotected intprotected Stringprotected Stringprotected Stringprotected Stringprotected Fileprotected Stringprotected Fileprotected Map<String, RoleMapping> protected Stringprotected TrustManagerFactoryprotected booleanFields inherited from class org.summerboot.jexpress.boot.config.BootConfig
BR, cache, cfgFile, configName, CPU_CORE, DESC_KMF, DESC_PLAINPWD, DESC_TMF, FILENAME_KEYSTORE, FILENAME_SRC_TRUSTSTORE, generateTemplate, logger, props -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDeclareRoles(Set<String> scanedDeclareRoles) protected voidcalled by @ConfigHeader.callbackMethodName4Dump valueprotected voidprotected voidprotected voidio.jsonwebtoken.JwtParserintgetKmf()intgetRoles()getTmf()booleanisTypeAD()protected voidloadCustomizedConfigs(File cfgFile, boolean isReal, ConfigUtil helper, Properties props) static voidvoidsetPasswordAlgorithm(String passwordAlgorithm) voidshutdown()temp()Methods inherited from class org.summerboot.jexpress.boot.config.BootConfig
buildThreadPoolExecutor, buildThreadPoolExecutor, buildThreadPoolExecutor, createIfNotExist, generateTemplate, getCfgFile, getLength, getProperties, info, instance, lineBreak, load, loadField, name, parse, preLoad, registerSingleton, updateConfigFile, updateFilePath
-
Field Details
-
cfg
-
typeAD
@ConfigHeader(title="1.1 LDAP connection settings") @Config(key="ldap.type.AD", desc="set it true only when LDAP is implemented by Microsoft Active Directory (AD)\nfalse when use others like Open LDAP, IBM Tivoli, Apache") protected volatile boolean typeAD -
ldapHost
-
ldapPort
-
ldapBaseDN
-
bindingUserDN
-
bindingPassword
-
passwordAlgorithm
@Config(key="ldap.PasswordAlgorithm", defaultValue="SHA3-256") protected volatile String passwordAlgorithm -
ldapScheamTenantGroupOU
-
kmf
@ConfigHeader(title="1.2 LDAP Client keystore") @Config(key="ldap.ssl.KeyStore", StorePwdKey="ldap.ssl.KeyStorePwd", AliasKey="ldap.ssl.KeyAlias", AliasPwdKey="ldap.ssl.KeyPwd", desc="Path to key store file. Use SSL/TLS when keystore is provided, otherwise use plain socket") protected volatile KeyManagerFactory kmf -
ldapTLSProtocol
-
ldapSSLConnectionFactoryClassName
-
tmf
@ConfigHeader(title="1.3 LDAP Client truststore") @Config(key="ldap.ssl.TrustStore", StorePwdKey="ldap.ssl.TrustStorePwd", desc="Path to trust store file. Auth the remote peer certificate when a truststore is provided, otherwise blindly trust all remote peer certificate") protected volatile TrustManagerFactory tmf -
ldapConfig
-
KEY_privateKeyFile
- See Also:
-
KEY_privateKeyPwd
- See Also:
-
KEY_publicKeyFile
- See Also:
-
JWT_PRIVATE_KEY_FILE
- See Also:
-
JWT_PUBLIC_KEY_FILE
- See Also:
-
privateKeyFile
@ConfigHeader(title="2. JWT", example="To generate the keypair manually:\nstep1. generate keypair: openssl genrsa -des3 -out keypair.pem 4096 \nstep2. export public key: openssl rsa -in keypair.pem -outform PEM -pubout -out jwt_public.key \nstep3. export private key: openssl rsa -in keypair.pem -out private_unencrypted.pem -outform PEM \nstep4. encrypt and convert private key from PKCS#1 to PKCS#8: openssl pkcs8 -topk8 -inform PEM -outform PEM -in private_unencrypted.pem -out jwt_private.key") @Config(key="jwt.asymmetric.SigningKeyFile", desc="Path to an encrypted RSA private key file in PKCS#8 format with minimal 2048 key size", callbackMethodName4Dump="generateTemplate_privateKeyFile") protected volatile File privateKeyFile -
privateKeyPwd
-
publicKeyFile
@Config(key="jwt.asymmetric.ParsingKeyFile", desc="Path to the public key file corresponding to this private key", callbackMethodName4Dump="generateTemplate_publicKeyFile") protected volatile File publicKeyFile -
symmetricKey
-
jwtSigningKey
-
jwtParser
protected volatile io.jsonwebtoken.JwtParser jwtParser -
jwtTTLMinutes
-
jwtIssuer
-
roles
@ConfigHeader(title="3. Role mapping", desc="Map the role (defined as @RolesAllowed({\"AppAdmin\"})) with user group (no matter the group is defined in LDAP or DB)", format="roles.<role name>.groups=csv list of groups\nroles.<role name>.users=csv list of users", example="the following example maps one group(AppAdmin_Group) and two users(johndoe, janejoe) to a role(AppAdmin)\nroles.AppAdmin.groups=AppAdmin_Group\nroles.AppAdmin.users=johndoe, janejoe", callbackMethodName4Dump="generateTemplate_DumpRoleMapping") protected Map<String,RoleMapping> roles -
declareRoles
-
-
Constructor Details
-
AuthConfig
protected AuthConfig()
-
-
Method Details
-
main
-
temp
- Specified by:
tempin interfaceJExpressConfig- Overrides:
tempin classBootConfig- Returns:
- null - disable reload
-
shutdown
public void shutdown() -
generateTemplate_privateKeyFile
-
generateTemplate_privateKeyPwd
-
generateTemplate_publicKeyFile
-
generateTemplate_DumpRoleMapping
called by @ConfigHeader.callbackMethodName4Dump value- Parameters:
sb-
-
loadCustomizedConfigs
protected void loadCustomizedConfigs(File cfgFile, boolean isReal, ConfigUtil helper, Properties props) throws IOException, org.bouncycastle.operator.OperatorCreationException, GeneralSecurityException - Specified by:
loadCustomizedConfigsin classBootConfig- Throws:
IOExceptionorg.bouncycastle.operator.OperatorCreationExceptionGeneralSecurityException
-
getLdapHost
-
getLdapPort
public int getLdapPort() -
getLdapBaseDN
-
getBindingUserDN
-
getLdapScheamTenantGroupOU
-
getPasswordAlgorithm
-
setPasswordAlgorithm
-
getLdapSSLConnectionFactoryClassName
-
getLdapTLSProtocol
-
isTypeAD
public boolean isTypeAD() -
getLdapConfig
-
getJwtSigningKey
-
getJwtParser
public io.jsonwebtoken.JwtParser getJwtParser() -
getJwtIssuer
-
getJwtTTLMinutes
public int getJwtTTLMinutes() -
getRole
-
getRoles
-
getBindingPassword
-
getKmf
-
getTmf
-
getPrivateKeyFile
-
getPrivateKeyPwd
-
getPublicKeyFile
-
getSymmetricKey
-
addDeclareRoles
-
getDeclareRoles
-