Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
config-server-api
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
何熠
config-server-api
Commits
9d6894b9
Commit
9d6894b9
authored
Dec 29, 2021
by
zhaoxiaolei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ldap
parent
84654aa2
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
116 additions
and
33 deletions
+116
-33
config-server-api.iml
config-server-api.iml
+9
-22
pom.xml
pom.xml
+9
-10
AuthServerApplication.java
src/main/java/cn/com/uitech/AuthServerApplication.java
+1
-0
IntegrateController.java
.../uitech/authorization/controller/IntegrateController.java
+8
-1
aquanTest.java
...ava/cn/com/uitech/authorization/controller/aquanTest.java
+19
-0
UserInfo.java
...ava/cn/com/uitech/authorization/pojo/entity/UserInfo.java
+3
-0
IntegrateService.java
...cn/com/uitech/authorization/service/IntegrateService.java
+4
-0
IntegrateServiceImpl.java
...tech/authorization/service/impl/IntegrateServiceImpl.java
+20
-0
LdapConfig.java
...in/java/cn/com/uitech/authorization/utils/LdapConfig.java
+38
-0
application-lcrx.yml
src/main/resources/application-lcrx.yml
+5
-0
No files found.
config-server-api.iml
View file @
9d6894b9
...
...
@@ -78,6 +78,8 @@
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot:2.1.5.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-autoconfigure:2.1.5.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: javax.annotation:javax.annotation-api:1.3.2"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-core:5.1.7.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-jcl:5.1.7.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"RUNTIME"
name=
"Maven: org.yaml:snakeyaml:1.23"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter-jdbc:2.1.5.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.zaxxer:HikariCP:3.2.0"
level=
"project"
/>
...
...
@@ -124,26 +126,6 @@
<orderEntry
type=
"library"
name=
"Maven: redis.clients:jedis:2.9.0"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.apache.commons:commons-pool2:2.6.2"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"PROVIDED"
name=
"Maven: org.projectlombok:lombok:1.18.8"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.springframework.boot:spring-boot-starter-test:2.1.5.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.springframework.boot:spring-boot-test:2.1.5.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.1.5.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: com.jayway.jsonpath:json-path:2.4.0"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: net.minidev:json-smart:2.3"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: net.minidev:accessors-smart:1.2"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.ow2.asm:asm:5.0.4"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: junit:junit:4.12"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.assertj:assertj-core:3.11.1"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.mockito:mockito-core:2.23.4"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: net.bytebuddy:byte-buddy:1.9.12"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: net.bytebuddy:byte-buddy-agent:1.9.12"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.objenesis:objenesis:2.6"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.hamcrest:hamcrest-core:1.3"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.hamcrest:hamcrest-library:1.3"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.skyscreamer:jsonassert:1.5.0"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-core:5.1.7.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-jcl:5.1.7.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.springframework:spring-test:5.1.7.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.xmlunit:xmlunit-core:2.6.2"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter-web:2.1.5.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter-json:2.1.5.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.8"
level=
"project"
/>
...
...
@@ -174,6 +156,7 @@
<orderEntry
type=
"library"
name=
"Maven: jakarta.persistence:jakarta.persistence-api:2.2.3"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.hibernate:hibernate-core:5.3.10.Final"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.javassist:javassist:3.23.2-GA"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: net.bytebuddy:byte-buddy:1.9.12"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: antlr:antlr:2.7.7"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.jboss:jandex:2.0.5.Final"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.dom4j:dom4j:2.1.1"
level=
"project"
/>
...
...
@@ -208,9 +191,12 @@
<orderEntry
type=
"library"
scope=
"RUNTIME"
name=
"Maven: org.codehaus.woodstox:woodstox-core-asl:4.2.0"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"RUNTIME"
name=
"Maven: org.codehaus.woodstox:stax2-api:3.1.1"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.apache.geronimo.specs:geronimo-activation_1.1_spec:1.0.2"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.apache.axis2:axis2-transport-http:1.7.7"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: commons-httpclient:commons-httpclient:3.1"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.cloud:spring-cloud-context:2.1.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.security:spring-security-crypto:5.1.5.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter-data-ldap:2.1.5.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.data:spring-data-ldap:2.1.8.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.ldap:spring-ldap-core:2.3.2.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: junit:junit:4.12"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.hamcrest:hamcrest-core:1.3"
level=
"project"
/>
</component>
</module>
\ No newline at end of file
pom.xml
View file @
9d6894b9
...
...
@@ -162,11 +162,6 @@
<artifactId>
lombok
</artifactId>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
...
...
@@ -234,15 +229,19 @@
<version>
1.7.7
</version>
</dependency>
<dependency>
<groupId>
org.apache.axis2
</groupId>
<artifactId>
axis2-transport-http
</artifactId>
<version>
1.7.7
</version>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-context
</artifactId>
<version>
2.1.0.RELEASE
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-ldap
</artifactId>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.12
</version>
</dependency>
</dependencies>
<build>
...
...
src/main/java/cn/com/uitech/AuthServerApplication.java
View file @
9d6894b9
...
...
@@ -5,6 +5,7 @@ import org.springframework.boot.SpringApplication;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.data.jpa.repository.config.EnableJpaAuditing
;
import
org.springframework.data.ldap.repository.config.EnableLdapRepositories
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
...
...
src/main/java/cn/com/uitech/authorization/controller/IntegrateController.java
View file @
9d6894b9
...
...
@@ -12,6 +12,7 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONObject
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.junit.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpEntity
;
...
...
@@ -20,7 +21,6 @@ import org.springframework.http.HttpMethod;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.validation.Errors
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.client.RestTemplate
;
...
...
@@ -349,5 +349,12 @@ public class IntegrateController {
return
ResultGenerator
.
genSuccessResult
(
integrateService
.
getUserDimension
(
userinfo
));
}
@PostMapping
(
"/checkToken"
)
@ApiOperation
(
value
=
"检查token是否过期"
,
notes
=
"checkToken"
,
httpMethod
=
"POST"
)
public
CrmResponseEntity
<?>
checkToken
(
@RequestBody
UserInfo
userinfo
)
{
return
ResultGenerator
.
genSuccessResult
(
integrateService
.
checkToken
(
userinfo
));
}
}
src/main/java/cn/com/uitech/authorization/controller/aquanTest.java
0 → 100644
View file @
9d6894b9
package
cn
.
com
.
uitech
.
authorization
.
controller
;
import
cn.com.uitech.authorization.service.IntegrateService
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
@Controller
public
class
aquanTest
{
@Autowired
IntegrateService
integrateService
;
@Test
public
void
testOne
()
{
System
.
out
.
println
(
"验证结果"
+
integrateService
.
ldapAuth
(
"ldapupdate"
,
"6KRutglNdiXp"
));
}
}
\ No newline at end of file
src/main/java/cn/com/uitech/authorization/pojo/entity/UserInfo.java
View file @
9d6894b9
...
...
@@ -6,6 +6,7 @@ import lombok.experimental.Accessors;
import
javax.persistence.Column
;
import
javax.persistence.Table
;
import
javax.persistence.Transient
;
@Accessors
(
chain
=
true
)
@NoArgsConstructor
...
...
@@ -25,4 +26,6 @@ public class UserInfo {
private
String
userName
;
@Column
(
name
=
"user_dimension"
)
private
String
userDimension
;
@Transient
private
String
token
;
}
src/main/java/cn/com/uitech/authorization/service/IntegrateService.java
View file @
9d6894b9
...
...
@@ -46,4 +46,8 @@ public interface IntegrateService {
Object
getToken
(
UserInfo
userinfo
);
Object
getUserDimension
(
UserInfo
userinfo
);
Object
checkToken
(
UserInfo
userinfo
);
boolean
ldapAuth
(
String
username
,
String
passWord
);
}
src/main/java/cn/com/uitech/authorization/service/impl/IntegrateServiceImpl.java
View file @
9d6894b9
...
...
@@ -19,6 +19,8 @@ import org.springframework.http.HttpEntity;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.ldap.core.LdapTemplate
;
import
org.springframework.ldap.filter.EqualsFilter
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -70,7 +72,19 @@ public class IntegrateServiceImpl implements IntegrateService {
private
String
content_type_msg
;
@Value
(
"${plm.header_Authorization}"
)
private
String
headerAuthorization
;
@Value
(
"${spring.ldap.base}"
)
private
String
base
;
@Autowired
private
LdapTemplate
ldapTemplate
;
@Override
public
boolean
ldapAuth
(
String
username
,
String
passWord
)
{
EqualsFilter
filter
=
new
EqualsFilter
(
"sAMAccountName"
,
username
);
return
ldapTemplate
.
authenticate
(
base
,
filter
.
toString
(),
passWord
);
}
@Override
public
GetProductOutDto
setSuperBOMInfo
(
List
<
SaveSuperBomInputDto
>
saveSuperBomInputDtos
)
{
...
...
@@ -647,6 +661,12 @@ public class IntegrateServiceImpl implements IntegrateService {
return
result
;
}
@Override
public
Object
checkToken
(
UserInfo
userinfo
)
{
return
null
;
}
/**
* @return Configid, SKUCode,SKUCode,产品型号,产品小型好,69码
...
...
src/main/java/cn/com/uitech/authorization/utils/LdapConfig.java
0 → 100644
View file @
9d6894b9
package
cn
.
com
.
uitech
.
authorization
.
utils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.ldap.core.LdapTemplate
;
import
org.springframework.ldap.core.support.LdapContextSource
;
@Configuration
public
class
LdapConfig
{
@Value
(
"${spring.ldap.urls}"
)
private
String
ldapUrl
;
@Value
(
"${spring.ldap.username}"
)
private
String
userName
;
@Value
(
"${spring.ldap.password}"
)
private
String
passWord
;
@Value
(
"${spring.ldap.base}"
)
private
String
base
;
@Bean
public
LdapContextSource
ldapContextSource
(){
LdapContextSource
source
=
new
LdapContextSource
();
source
.
setBase
(
base
);
source
.
setUrl
(
ldapUrl
);
source
.
setPassword
(
passWord
);
source
.
setUserDn
(
userName
);
return
source
;
}
@Bean
public
LdapTemplate
ldapTemplate
(){
return
new
LdapTemplate
(
ldapContextSource
());
}
}
src/main/resources/application-lcrx.yml
View file @
9d6894b9
...
...
@@ -36,6 +36,11 @@ spring:
sleuth
:
sampler
:
probability
:
1.0
ldap
:
urls
:
ldap://10.0.2.3:389
base
:
OU=紫光计算机,DC=unispc,DC=com
username
:
ldapupdate
password
:
6KRutglNdiXp
selector
:
url
:
http://10.0.4.24:8080/api/v1/selector
...
...
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