Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
matrix
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mall
arch
matrix
Commits
1db65304
Commit
1db65304
authored
Aug 24, 2021
by
郑冰晶
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据库加密组件
parent
f35eec17
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
188 additions
and
59 deletions
+188
-59
application.yml
matrix-datasource/matrix-datasource-security/matrix-datasource-security-demo/src/main/resources/application.yml
+4
-8
SecurityAlgorithm.java
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/algorithm/SecurityAlgorithm.java
+6
-0
SecurityAlgorithmPostProcessor.java
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/algorithm/SecurityAlgorithmPostProcessor.java
+5
-0
AESEncryptAlgorithm.java
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/algorithm/encrypt/AESEncryptAlgorithm.java
+5
-5
EncryptAlgorithm.java
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/algorithm/encrypt/EncryptAlgorithm.java
+3
-4
RC4EncryptAlgorithm.java
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/algorithm/encrypt/RC4EncryptAlgorithm.java
+138
-0
ApolloPropertyProviderAlgorithm.java
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/algorithm/property/ApolloPropertyProviderAlgorithm.java
+7
-2
PropertyProviderAlgorithm.java
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/algorithm/property/PropertyProviderAlgorithm.java
+4
-3
EncryptType.java
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/constant/EncryptType.java
+1
-1
PropertyProviderAlgorithmFactory.java
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/factory/PropertyProviderAlgorithmFactory.java
+0
-17
SecurityAlgorithmFactory.java
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/factory/SecurityAlgorithmFactory.java
+12
-3
SecurityFilter.java
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/filter/SecurityFilter.java
+1
-1
SecurityFilterContext.java
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/filter/SecurityFilterContext.java
+2
-2
ColumnRule.java
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/rule/ColumnRule.java
+0
-13
No files found.
matrix-datasource/matrix-datasource-security/matrix-datasource-security-demo/src/main/resources/application.yml
View file @
1db65304
...
@@ -7,30 +7,26 @@ spring:
...
@@ -7,30 +7,26 @@ spring:
secooActivityDB
:
secooActivityDB
:
t_price_rule_task
:
t_price_rule_task
:
creator
:
creator
:
cipherColumn
:
creator
encryptKey
:
123
encryptKey
:
123
encryptType
:
AES
encryptType
:
AES
logicColumn
:
creator
plainColumn
:
creator
plainColumn
:
creator
cipherColumn
:
creator
modifior
:
modifior
:
cipherColumn
:
modifior
encryptKey
:
123
encryptKey
:
123
encryptType
:
AES
encryptType
:
AES
logicColumn
:
modifior
plainColumn
:
modifior
plainColumn
:
modifior
cipherColumn
:
modifior
t_smart_batch
:
t_smart_batch
:
creator
:
creator
:
cipherColumn
:
creator
encryptKey
:
456
encryptKey
:
456
encryptType
:
AES
encryptType
:
AES
logicColumn
:
creator
plainColumn
:
creator
plainColumn
:
creator
cipherColumn
:
creator
modifior
:
modifior
:
cipherColumn
:
modifior
encryptKey
:
456
encryptKey
:
456
encryptType
:
AES
encryptType
:
AES
logicColumn
:
modifior
plainColumn
:
modifior
plainColumn
:
modifior
cipherColumn
:
modifior
server
:
server
:
...
...
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/algorithm/SecurityAlgorithm.java
0 → 100644
View file @
1db65304
package
com
.
secoo
.
mall
.
datasource
.
security
.
algorithm
;
import
com.secoo.mall.datasource.security.spi.TypedSPI
;
public
interface
SecurityAlgorithm
extends
TypedSPI
{
}
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/algorithm/SecurityAlgorithmPostProcessor.java
0 → 100644
View file @
1db65304
package
com
.
secoo
.
mall
.
datasource
.
security
.
algorithm
;
public
interface
SecurityAlgorithmPostProcessor
{
void
init
();
}
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/algorithm/encrypt/AESEncryptAlgorithm.java
View file @
1db65304
...
@@ -24,6 +24,11 @@ public final class AESEncryptAlgorithm implements EncryptAlgorithm {
...
@@ -24,6 +24,11 @@ public final class AESEncryptAlgorithm implements EncryptAlgorithm {
private
byte
[]
secretKey
;
private
byte
[]
secretKey
;
@Override
@Override
public
void
init
(){
this
.
secretKey
=
createSecretKey
();
}
@Override
public
String
encrypt
(
final
Object
plaintext
)
throws
GeneralSecurityException
{
public
String
encrypt
(
final
Object
plaintext
)
throws
GeneralSecurityException
{
if
(
null
==
plaintext
)
{
if
(
null
==
plaintext
)
{
return
null
;
return
null
;
...
@@ -46,11 +51,6 @@ public final class AESEncryptAlgorithm implements EncryptAlgorithm {
...
@@ -46,11 +51,6 @@ public final class AESEncryptAlgorithm implements EncryptAlgorithm {
return
EncryptType
.
AES
;
return
EncryptType
.
AES
;
}
}
@Override
public
void
init
(){
this
.
secretKey
=
createSecretKey
();
}
public
Properties
getProps
()
{
public
Properties
getProps
()
{
return
this
.
props
;
return
this
.
props
;
}
}
...
...
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/algorithm/encrypt/EncryptAlgorithm.java
View file @
1db65304
package
com
.
secoo
.
mall
.
datasource
.
security
.
algorithm
.
encrypt
;
package
com
.
secoo
.
mall
.
datasource
.
security
.
algorithm
.
encrypt
;
import
com.secoo.mall.datasource.security.spi.TypedSPI
;
import
com.secoo.mall.datasource.security.algorithm.SecurityAlgorithm
;
import
com.secoo.mall.datasource.security.algorithm.SecurityAlgorithmPostProcessor
;
import
java.security.GeneralSecurityException
;
import
java.security.GeneralSecurityException
;
/**
/**
* Encrypt|decrypt algorithm for SPI.
* Encrypt|decrypt algorithm for SPI.
*/
*/
public
interface
EncryptAlgorithm
extends
TypedSPI
{
public
interface
EncryptAlgorithm
extends
SecurityAlgorithm
,
SecurityAlgorithmPostProcessor
{
String
ENCRYPT_KEY
=
"encrypt-key-value"
;
String
ENCRYPT_KEY
=
"encrypt-key-value"
;
void
init
();
/**
/**
* Encode.
* Encode.
*
*
...
...
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/algorithm/encrypt/RC4EncryptAlgorithm.java
0 → 100644
View file @
1db65304
package
com
.
secoo
.
mall
.
datasource
.
security
.
algorithm
.
encrypt
;
import
com.secoo.mall.datasource.security.exception.SecurityBizException
;
import
org.apache.commons.codec.binary.Base64
;
import
org.apache.commons.codec.binary.StringUtils
;
import
java.nio.charset.StandardCharsets
;
import
java.security.GeneralSecurityException
;
import
java.util.Arrays
;
import
java.util.Properties
;
/**
* RC4 encrypt algorithm.
*/
public
class
RC4EncryptAlgorithm
implements
EncryptAlgorithm
{
private
Properties
props
=
new
Properties
();
private
static
final
int
SBOX_LENGTH
=
256
;
private
static
final
int
KEY_MIN_LENGTH
=
5
;
private
byte
[]
key
=
new
byte
[
SBOX_LENGTH
-
1
];
private
int
[]
sBox
=
new
int
[
SBOX_LENGTH
];
@Override
public
void
init
()
{
reset
();
setKey
(
StringUtils
.
getBytesUtf8
(
props
.
getProperty
(
ENCRYPT_KEY
)));
}
@Override
public
String
encrypt
(
Object
plainText
)
throws
GeneralSecurityException
{
if
(
null
==
plainText
)
{
return
null
;
}
byte
[]
result
=
handle
(
StringUtils
.
getBytesUtf8
(
String
.
valueOf
(
plainText
)),
key
);
return
Base64
.
encodeBase64String
(
result
);
}
@Override
public
String
decrypt
(
String
cipherText
)
throws
GeneralSecurityException
{
if
(
null
==
cipherText
)
{
return
null
;
}
byte
[]
result
=
handle
(
Base64
.
decodeBase64
(
cipherText
),
key
);
return
new
String
(
result
,
StandardCharsets
.
UTF_8
);
}
@Override
public
String
getType
()
{
return
null
;
}
@Override
public
Properties
getProps
()
{
return
props
;
}
@Override
public
void
setProps
(
Properties
props
)
{
this
.
props
=
props
;
}
private
byte
[]
handle
(
final
byte
[]
data
,
final
byte
[]
key
)
{
reset
();
setKey
(
key
);
byte
[]
result
=
crypt
(
data
);
reset
();
return
result
;
}
private
void
reset
()
{
Arrays
.
fill
(
key
,
(
byte
)
0
);
Arrays
.
fill
(
sBox
,
0
);
}
/**
* Crypt given byte array. Be aware, that you must init key, before using.
* @param message array to be crypt
* @return byte array
* @see <a href="http://en.wikipedia.org/wiki/RC4#Pseudo-random_generation_algorithm_.28PRGA.29">Pseudo-random generation algorithm</a>
*/
private
byte
[]
crypt
(
final
byte
[]
message
)
{
sBox
=
initSBox
(
key
);
byte
[]
result
=
new
byte
[
message
.
length
];
int
i
=
0
;
int
j
=
0
;
for
(
int
n
=
0
;
n
<
message
.
length
;
n
++)
{
i
=
(
i
+
1
)
%
SBOX_LENGTH
;
j
=
(
j
+
sBox
[
i
])
%
SBOX_LENGTH
;
swap
(
i
,
j
,
sBox
);
int
rand
=
sBox
[(
sBox
[
i
]
+
sBox
[
j
])
%
SBOX_LENGTH
];
result
[
n
]
=
(
byte
)
(
rand
^
message
[
n
]);
}
return
result
;
}
/**
* Initialize SBOX with given key, Key-scheduling algorithm.
*
* @param key key
* @return sBox int array
* @see <a href="http://en.wikipedia.org/wiki/RC4#Key-scheduling_algorithm_.28KSA.29">Wikipedia. Init sBox</a>
*/
private
int
[]
initSBox
(
final
byte
[]
key
)
{
int
[]
result
=
new
int
[
SBOX_LENGTH
];
int
j
=
0
;
for
(
int
i
=
0
;
i
<
SBOX_LENGTH
;
i
++)
{
result
[
i
]
=
i
;
}
for
(
int
i
=
0
;
i
<
SBOX_LENGTH
;
i
++)
{
j
=
(
j
+
result
[
i
]
+
(
key
[
i
%
key
.
length
])
&
0xFF
)
%
SBOX_LENGTH
;
swap
(
i
,
j
,
result
);
}
return
result
;
}
private
void
swap
(
final
int
i
,
final
int
j
,
final
int
[]
sBox
)
{
int
temp
=
sBox
[
i
];
sBox
[
i
]
=
sBox
[
j
];
sBox
[
j
]
=
temp
;
}
/**
* Set key.
*
* @param key key to be setup
* @throws SecurityBizException if key length is smaller than 5 or bigger than 255
*/
private
void
setKey
(
final
byte
[]
key
)
throws
SecurityBizException
{
if
(!(
key
.
length
>=
KEY_MIN_LENGTH
&&
key
.
length
<
SBOX_LENGTH
))
{
throw
new
SecurityBizException
(
"Key length has to be between "
+
KEY_MIN_LENGTH
+
" and "
+
(
SBOX_LENGTH
-
1
));
}
this
.
key
=
key
;
}
}
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/algorithm/property/ApolloPropertyProviderAlgorithm.java
View file @
1db65304
...
@@ -10,7 +10,7 @@ import com.secoo.mall.datasource.security.config.DataSourceSecurityProperties;
...
@@ -10,7 +10,7 @@ import com.secoo.mall.datasource.security.config.DataSourceSecurityProperties;
import
com.secoo.mall.datasource.security.constant.PropertyProviderType
;
import
com.secoo.mall.datasource.security.constant.PropertyProviderType
;
import
com.secoo.mall.datasource.security.constant.SymbolConstants
;
import
com.secoo.mall.datasource.security.constant.SymbolConstants
;
import
com.secoo.mall.datasource.security.exception.SecurityBizException
;
import
com.secoo.mall.datasource.security.exception.SecurityBizException
;
import
com.secoo.mall.datasource.security.factory.
Encrypt
AlgorithmFactory
;
import
com.secoo.mall.datasource.security.factory.
Security
AlgorithmFactory
;
import
com.secoo.mall.datasource.security.rule.ColumnRule
;
import
com.secoo.mall.datasource.security.rule.ColumnRule
;
import
com.secoo.mall.datasource.security.rule.DbRule
;
import
com.secoo.mall.datasource.security.rule.DbRule
;
import
com.secoo.mall.datasource.security.rule.TableRule
;
import
com.secoo.mall.datasource.security.rule.TableRule
;
...
@@ -119,7 +119,7 @@ public class ApolloPropertyProviderAlgorithm implements PropertyProviderAlgorith
...
@@ -119,7 +119,7 @@ public class ApolloPropertyProviderAlgorithm implements PropertyProviderAlgorith
}
}
Properties
properties
=
new
Properties
();
Properties
properties
=
new
Properties
();
properties
.
setProperty
(
EncryptAlgorithm
.
ENCRYPT_KEY
,
columnRule
.
getEncryptKey
());
properties
.
setProperty
(
EncryptAlgorithm
.
ENCRYPT_KEY
,
columnRule
.
getEncryptKey
());
EncryptAlgorithm
encryptAlgorithm
=
EncryptAlgorithmFactory
.
getObject
(
columnRule
.
getEncryptType
().
toLowerCase
(),
properties
);
EncryptAlgorithm
encryptAlgorithm
=
SecurityAlgorithmFactory
.
getObject
(
EncryptAlgorithm
.
class
,
columnRule
.
getEncryptType
().
toLowerCase
(),
properties
);
encryptAlgorithm
.
init
();
encryptAlgorithm
.
init
();
columnRule
.
setEncryptAlgorithm
(
encryptAlgorithm
);
columnRule
.
setEncryptAlgorithm
(
encryptAlgorithm
);
...
@@ -153,6 +153,11 @@ public class ApolloPropertyProviderAlgorithm implements PropertyProviderAlgorith
...
@@ -153,6 +153,11 @@ public class ApolloPropertyProviderAlgorithm implements PropertyProviderAlgorith
return
PropertyProviderType
.
APOLLO
;
return
PropertyProviderType
.
APOLLO
;
}
}
@Override
public
void
init
()
{
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
// String x = "a-b-c";
// String x = "a-b-c";
// System.out.println(JSON.toJSONString(x.split("-",2)));
// System.out.println(JSON.toJSONString(x.split("-",2)));
...
...
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/algorithm/property/PropertyProviderAlgorithm.java
View file @
1db65304
package
com
.
secoo
.
mall
.
datasource
.
security
.
algorithm
.
property
;
package
com
.
secoo
.
mall
.
datasource
.
security
.
algorithm
.
property
;
import
com.secoo.mall.datasource.security.algorithm.SecurityAlgorithm
;
import
com.secoo.mall.datasource.security.algorithm.SecurityAlgorithmPostProcessor
;
import
com.secoo.mall.datasource.security.config.DataSourceSecurityProperties
;
import
com.secoo.mall.datasource.security.config.DataSourceSecurityProperties
;
import
com.secoo.mall.datasource.security.spi.TypedSPI
;
/**
/**
*
Encrypt|decrypt
algorithm for SPI.
*
PropertyProvider
algorithm for SPI.
*/
*/
public
interface
PropertyProviderAlgorithm
extends
TypedSPI
{
public
interface
PropertyProviderAlgorithm
extends
SecurityAlgorithm
,
SecurityAlgorithmPostProcessor
{
DataSourceSecurityProperties
load
();
DataSourceSecurityProperties
load
();
}
}
...
...
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/constant/EncryptType.java
View file @
1db65304
package
com
.
secoo
.
mall
.
datasource
.
security
.
constant
;
package
com
.
secoo
.
mall
.
datasource
.
security
.
constant
;
public
class
EncryptType
{
public
class
EncryptType
{
public
static
final
String
DES
=
"des"
;
public
static
final
String
AES
=
"aes"
;
public
static
final
String
AES
=
"aes"
;
public
static
final
String
RC4
=
"rc4"
;
}
}
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/factory/PropertyProviderAlgorithmFactory.java
deleted
100644 → 0
View file @
f35eec17
package
com
.
secoo
.
mall
.
datasource
.
security
.
factory
;
import
com.secoo.mall.datasource.security.algorithm.property.PropertyProviderAlgorithm
;
import
com.secoo.mall.datasource.security.spi.SecurityServiceLoader
;
import
com.secoo.mall.datasource.security.spi.TypedSPIRegistry
;
import
java.util.Properties
;
public
class
PropertyProviderAlgorithmFactory
{
static
{
SecurityServiceLoader
.
register
(
PropertyProviderAlgorithm
.
class
);
}
public
static
PropertyProviderAlgorithm
getObject
(
String
type
,
Properties
props
)
{
return
TypedSPIRegistry
.
getRegisteredService
(
PropertyProviderAlgorithm
.
class
,
type
,
props
);
}
}
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/factory/
Encrypt
AlgorithmFactory.java
→
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/factory/
Security
AlgorithmFactory.java
View file @
1db65304
package
com
.
secoo
.
mall
.
datasource
.
security
.
factory
;
package
com
.
secoo
.
mall
.
datasource
.
security
.
factory
;
import
com.secoo.mall.datasource.security.algorithm.SecurityAlgorithm
;
import
com.secoo.mall.datasource.security.algorithm.SecurityAlgorithmPostProcessor
;
import
com.secoo.mall.datasource.security.algorithm.encrypt.EncryptAlgorithm
;
import
com.secoo.mall.datasource.security.algorithm.encrypt.EncryptAlgorithm
;
import
com.secoo.mall.datasource.security.algorithm.property.PropertyProviderAlgorithm
;
import
com.secoo.mall.datasource.security.spi.SecurityServiceLoader
;
import
com.secoo.mall.datasource.security.spi.SecurityServiceLoader
;
import
com.secoo.mall.datasource.security.spi.TypedSPIRegistry
;
import
com.secoo.mall.datasource.security.spi.TypedSPIRegistry
;
import
java.util.Properties
;
import
java.util.Properties
;
public
class
Encrypt
AlgorithmFactory
{
public
class
Security
AlgorithmFactory
{
static
{
static
{
SecurityServiceLoader
.
register
(
EncryptAlgorithm
.
class
);
SecurityServiceLoader
.
register
(
EncryptAlgorithm
.
class
);
SecurityServiceLoader
.
register
(
PropertyProviderAlgorithm
.
class
);
}
}
public
static
EncryptAlgorithm
getObject
(
String
type
,
Properties
props
)
{
@SuppressWarnings
(
"unchecked"
)
return
TypedSPIRegistry
.
getRegisteredService
(
EncryptAlgorithm
.
class
,
type
,
props
);
public
static
<
T
extends
SecurityAlgorithm
>
T
getObject
(
final
Class
<?
extends
SecurityAlgorithm
>
algorithmClass
,
String
type
,
Properties
props
)
{
T
result
=
(
T
)
TypedSPIRegistry
.
getRegisteredService
(
algorithmClass
,
type
,
props
);
if
(
result
instanceof
SecurityAlgorithmPostProcessor
)
{
((
SecurityAlgorithmPostProcessor
)
result
).
init
();
}
return
result
;
}
}
}
}
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/filter/SecurityFilter.java
View file @
1db65304
...
@@ -524,7 +524,7 @@ public class SecurityFilter extends FilterEventAdapter {
...
@@ -524,7 +524,7 @@ public class SecurityFilter extends FilterEventAdapter {
Map
<
String
,
ColumnRule
>
columnRuleMap
=
new
HashMap
<>();
Map
<
String
,
ColumnRule
>
columnRuleMap
=
new
HashMap
<>();
for
(
ColumnRule
columnRule:
tableRule
.
getColumnRules
()){
for
(
ColumnRule
columnRule:
tableRule
.
getColumnRules
()){
columnRuleMap
.
put
(
columnRule
.
get
Logic
Column
(),
columnRule
);
columnRuleMap
.
put
(
columnRule
.
get
Cipher
Column
(),
columnRule
);
}
}
tableRuleMap
.
put
(
tableRule
.
getTableName
(),
columnRuleMap
);
tableRuleMap
.
put
(
tableRule
.
getTableName
(),
columnRuleMap
);
...
...
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/filter/SecurityFilterContext.java
View file @
1db65304
...
@@ -5,7 +5,7 @@ import com.secoo.mall.datasource.security.algorithm.property.PropertyProviderAlg
...
@@ -5,7 +5,7 @@ import com.secoo.mall.datasource.security.algorithm.property.PropertyProviderAlg
import
com.secoo.mall.datasource.security.config.DataSourceSecurityProperties
;
import
com.secoo.mall.datasource.security.config.DataSourceSecurityProperties
;
import
com.secoo.mall.datasource.security.constant.PropertyProviderType
;
import
com.secoo.mall.datasource.security.constant.PropertyProviderType
;
import
com.secoo.mall.datasource.security.exception.SecurityBizException
;
import
com.secoo.mall.datasource.security.exception.SecurityBizException
;
import
com.secoo.mall.datasource.security.factory.
PropertyProvider
AlgorithmFactory
;
import
com.secoo.mall.datasource.security.factory.
Security
AlgorithmFactory
;
import
com.secoo.mall.datasource.security.rule.DbRule
;
import
com.secoo.mall.datasource.security.rule.DbRule
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -41,7 +41,7 @@ public class SecurityFilterContext {
...
@@ -41,7 +41,7 @@ public class SecurityFilterContext {
if
(
StringUtils
.
isBlank
(
propertyProvider
)){
if
(
StringUtils
.
isBlank
(
propertyProvider
)){
propertyProvider
=
DEFAULT_PROPERTY_PROVIDER
;
propertyProvider
=
DEFAULT_PROPERTY_PROVIDER
;
}
}
PropertyProviderAlgorithm
propertyProviderAlgorithm
=
PropertyProviderAlgorithmFactory
.
getObject
(
propertyProvider
,
new
Properties
());
PropertyProviderAlgorithm
propertyProviderAlgorithm
=
SecurityAlgorithmFactory
.
getObject
(
PropertyProviderAlgorithm
.
class
,
propertyProvider
,
new
Properties
());
DataSourceSecurityProperties
dataSourceSecurityProperties
=
propertyProviderAlgorithm
.
load
();
DataSourceSecurityProperties
dataSourceSecurityProperties
=
propertyProviderAlgorithm
.
load
();
if
(
dataSourceSecurityProperties
==
null
){
if
(
dataSourceSecurityProperties
==
null
){
log
.
error
(
"!!! Can not find security rules !!!"
);
log
.
error
(
"!!! Can not find security rules !!!"
);
...
...
matrix-datasource/matrix-datasource-security/matrix-datasource-security-druid/src/main/java/com/secoo/mall/datasource/security/rule/ColumnRule.java
View file @
1db65304
...
@@ -12,10 +12,6 @@ public class ColumnRule {
...
@@ -12,10 +12,6 @@ public class ColumnRule {
*/
*/
private
String
encryptKey
;
private
String
encryptKey
;
/**
/**
* 逻辑字段名称
*/
private
String
logicColumn
;
/**
* 明文字段名称
* 明文字段名称
*/
*/
private
String
plainColumn
;
private
String
plainColumn
;
...
@@ -45,14 +41,6 @@ public class ColumnRule {
...
@@ -45,14 +41,6 @@ public class ColumnRule {
this
.
encryptKey
=
encryptKey
;
this
.
encryptKey
=
encryptKey
;
}
}
public
String
getLogicColumn
()
{
return
logicColumn
;
}
public
void
setLogicColumn
(
String
logicColumn
)
{
this
.
logicColumn
=
logicColumn
;
}
public
String
getPlainColumn
()
{
public
String
getPlainColumn
()
{
return
plainColumn
;
return
plainColumn
;
}
}
...
@@ -82,7 +70,6 @@ public class ColumnRule {
...
@@ -82,7 +70,6 @@ public class ColumnRule {
return
"ColumnRule{"
+
return
"ColumnRule{"
+
"encryptType='"
+
encryptType
+
'\''
+
"encryptType='"
+
encryptType
+
'\''
+
", encryptKey='"
+
encryptKey
+
'\''
+
", encryptKey='"
+
encryptKey
+
'\''
+
", logicColumn='"
+
logicColumn
+
'\''
+
", plainColumn='"
+
plainColumn
+
'\''
+
", plainColumn='"
+
plainColumn
+
'\''
+
", cipherColumn='"
+
cipherColumn
+
'\''
+
", cipherColumn='"
+
cipherColumn
+
'\''
+
", encryptAlgorithm="
+
encryptAlgorithm
+
", encryptAlgorithm="
+
encryptAlgorithm
+
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment