Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
ydl-auth
Overview
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
王建峰
ydl-auth
Commits
af5fcf9f
Commit
af5fcf9f
authored
Dec 10, 2019
by
wangdayewjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
6982407a
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
952 additions
and
0 deletions
+952
-0
pom.xml
ydl-auth/ydl-auth-api/pom.xml
+16
-0
Swagger2Config.java
ydl-auth/ydl-auth-api/src/main/java/com/ydl/auth/Swagger2Config.java
+32
-0
YdlAuthApplication.java
ydl-auth/ydl-auth-api/src/main/java/com/ydl/auth/YdlAuthApplication.java
+24
-0
Constants.java
ydl-auth/ydl-auth-api/src/main/java/com/ydl/auth/apis/Constants.java
+247
-0
SignController.java
ydl-auth/ydl-auth-api/src/main/java/com/ydl/auth/apis/SignController.java
+70
-0
RequestDTO.java
ydl-auth/ydl-auth-api/src/main/java/com/ydl/auth/dto/RequestDTO.java
+124
-0
application.yml
ydl-auth/ydl-auth-api/src/main/resources/application.yml
+128
-0
pom.xml
ydl-auth/ydl-auth-inf/pom.xml
+16
-0
AppAuthFacade.java
ydl-auth/ydl-auth-inf/src/main/java/com/ydl/auth/inf/AppAuthFacade.java
+4
-0
AppAuth.java
ydl-auth/ydl-auth-inf/src/main/java/com/ydl/auth/po/AppAuth.java
+18
-0
AppAuthRsp.java
ydl-auth/ydl-auth-inf/src/main/java/com/ydl/auth/po/rsp/AppAuthRsp.java
+17
-0
pom.xml
ydl-auth/ydl-auth-service/pom.xml
+16
-0
YdlAuthServiceApplication.java
ydl-auth/ydl-auth-service/src/main/java/com/ydl/auth/service/YdlAuthServiceApplication.java
+24
-0
AppAuthBiz.java
ydl-auth/ydl-auth-service/src/main/java/com/ydl/auth/service/biz/AppAuthBiz.java
+4
-0
AppAuthBizImpl.java
ydl-auth/ydl-auth-service/src/main/java/com/ydl/auth/service/biz/impl/AppAuthBizImpl.java
+4
-0
MybatisConfig.java
ydl-auth/ydl-auth-service/src/main/java/com/ydl/auth/service/config/MybatisConfig.java
+37
-0
DataSourceConfig.java
ydl-auth/ydl-auth-service/src/main/java/com/ydl/auth/service/config/source/DataSourceConfig.java
+36
-0
DataSourceProps.java
ydl-auth/ydl-auth-service/src/main/java/com/ydl/auth/service/config/source/DataSourceProps.java
+46
-0
AppAuthMapper.java
ydl-auth/ydl-auth-service/src/main/java/com/ydl/auth/service/dao/AppAuthMapper.java
+4
-0
AppAuthFacadeImpl.java
ydl-auth/ydl-auth-service/src/main/java/com/ydl/auth/service/facade/AppAuthFacadeImpl.java
+4
-0
application.yml
ydl-auth/ydl-auth-service/src/main/resources/application.yml
+81
-0
AppAuthMapper.xml
ydl-auth/ydl-auth-service/src/main/resources/sqlmap/AppAuthMapper.xml
+0
-0
No files found.
ydl-auth/ydl-auth-api/pom.xml
0 → 100644
View file @
af5fcf9f
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
ydl-auth
</artifactId>
<groupId>
com.ydl
</groupId>
<version>
0.0.1-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
ydl-auth-api
</artifactId>
</project>
\ No newline at end of file
ydl-auth/ydl-auth-api/src/main/java/com/ydl/auth/Swagger2Config.java
0 → 100644
View file @
af5fcf9f
package
com
.
ydl
.
ydlauth
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
springfox.documentation.builders.ApiInfoBuilder
;
import
springfox.documentation.builders.PathSelectors
;
import
springfox.documentation.builders.RequestHandlerSelectors
;
import
springfox.documentation.service.ApiInfo
;
import
springfox.documentation.service.Contact
;
import
springfox.documentation.spi.DocumentationType
;
import
springfox.documentation.spring.web.plugins.Docket
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
@Configuration
@EnableSwagger2
public
class
Swagger2Config
{
@Bean
public
Docket
createRestApi
()
{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
).
apiInfo
(
apiInfo
()).
select
().
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.ydl.advertise.api.apis"
))
.
paths
(
PathSelectors
.
any
()).
build
();
}
private
ApiInfo
apiInfo
()
{
ApiInfo
apiInfo
=
new
ApiInfoBuilder
().
title
(
"壹点灵服务端接口文档"
).
description
(
"壹点灵接口管理"
).
license
(
"MIT"
).
licenseUrl
(
"http://opensource.org/licenses/MIT"
)
.
contact
(
new
Contact
(
""
,
""
,
""
)).
version
(
"1.0"
).
build
();
return
apiInfo
;
}
}
\ No newline at end of file
ydl-auth/ydl-auth-api/src/main/java/com/ydl/auth/YdlAuthApplication.java
0 → 100644
View file @
af5fcf9f
package
com
.
ydl
.
ydlauth
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
@SpringBootApplication
@Slf4j
@ComponentScan
({
"com.ydl"
})
@EnableScheduling
public
class
YdlAuthApplication
{
public
static
void
main
(
String
[]
args
)
{
try
{
SpringApplication
.
run
(
YdlAuthApplication
.
class
,
args
);
}
catch
(
Throwable
e
)
{
log
.
error
(
""
,
e
);
}
}
}
\ No newline at end of file
ydl-auth/ydl-auth-api/src/main/java/com/ydl/auth/apis/Constants.java
0 → 100644
View file @
af5fcf9f
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
com
.
ydl
.
auth
.
apis
;
/**
* Constants.
*
* @author xiaoyu(Myth)
*/
public
interface
Constants
{
/**
* The constant APP_PARAM.
*/
String
APP_PARAM
=
"appParam"
;
/**
* The constant REQUESTDTO.
*/
String
REQUESTDTO
=
"requestDTO"
;
/**
* The constant CLIENT_RESPONSE_ATTR.
*/
String
CLIENT_RESPONSE_ATTR
=
"webHandlerClientResponse"
;
/**
* The constant DUBBO_RPC_RESULT.
*/
String
DUBBO_RPC_RESULT
=
"dubbo_rpc_result"
;
/**
* The constant DUBBO_RPC_RESULT_EMPTY.
*/
String
DUBBO_RPC_RESULT_EMPTY
=
"dubbo has not return value!"
;
/**
* The constant CLIENT_RESPONSE_RESULT_TYPE.
*/
String
CLIENT_RESPONSE_RESULT_TYPE
=
"webHandlerClientResponseResultType"
;
/**
* The constant CLIENT_RESPONSE_CONN_ATTR.
*/
String
CLIENT_RESPONSE_CONN_ATTR
=
"nettyClientResponseConnection"
;
/**
* The constant HTTP_TIME_OUT.
*/
String
HTTP_TIME_OUT
=
"httpTimeOut"
;
/**
* Original response Content-Type attribute name.
*/
String
ORIGINAL_RESPONSE_CONTENT_TYPE_ATTR
=
"original_response_content_type"
;
/**
* The constant HTTP_URL.
*/
String
HTTP_URL
=
"httpUrl"
;
/**
* The constant DUBBO_PARAMS.
*/
String
DUBBO_PARAMS
=
"dubbo_params"
;
/**
* The constant DECODE.
*/
String
DECODE
=
"UTF-8"
;
/**
* The constant MODULE.
*/
String
MODULE
=
"module"
;
/**
* The constant METHOD.
*/
String
METHOD
=
"method"
;
/**
* The constant APP_KEY.
*/
String
APP_KEY
=
"appKey"
;
/**
* The constant EXT_INFO.
*/
String
EXT_INFO
=
"extInfo"
;
/**
* The constant PATH_VARIABLE.
*/
String
PATH_VARIABLE
=
"pathVariable"
;
/**
* The constant HTTP_METHOD.
*/
String
HTTP_METHOD
=
"httpMethod"
;
/**
* The constant RPC_TYPE.
*/
String
RPC_TYPE
=
"rpcType"
;
/**
* The constant SIGN.
*/
String
SIGN
=
"sign"
;
/**
* The constant PATH.
*/
String
PATH
=
"path"
;
/**
* The constant VERSION.
*/
String
VERSION
=
"version"
;
/**
* The constant SIGN_PARAMS_ERROR.
*/
String
SIGN_PARAMS_ERROR
=
"认证参数传入不完整!"
;
/**
* The constant SIGN_APP_KEY_IS_NOT_EXIST.
*/
String
SIGN_APP_KEY_IS_NOT_EXIST
=
"认证签名APP_KEY,不存在"
;
/**
* The constant SIGN_PATH_NOT_EXIST.
*/
String
SIGN_PATH_NOT_EXIST
=
"认证Key未配置路径获取未匹配"
;
/**
* The constant SIGN_VALUE_IS_ERROR.
*/
String
SIGN_VALUE_IS_ERROR
=
"签名值错误!"
;
/**
* The constant TIMESTAMP.
*/
String
TIMESTAMP
=
"timestamp"
;
/**
* The constant REJECT_MSG.
*/
String
REJECT_MSG
=
" You are forbidden to visit"
;
/**
* The constant REWRITE_URI.
*/
String
REWRITE_URI
=
"rewrite_uri"
;
/**
* The constant HTTP_ERROR_RESULT.
*/
String
HTTP_ERROR_RESULT
=
"this is bad request or fuse ing please try again later"
;
/**
* The constant DUBBO_ERROR_RESULT.
*/
String
DUBBO_ERROR_RESULT
=
"dubbo rpc have error or fuse ing please check your param and try again later"
;
/**
* The constant SPRING_CLOUD_ERROR_RESULT.
*/
String
SPRING_CLOUD_ERROR_RESULT
=
"spring cloud rpc have error or fuse ing please check your param and try again later"
;
/**
* The constant TIMEOUT_RESULT.
*/
String
TIMEOUT_RESULT
=
"this request is time out Please try again later"
;
/**
* The constant UPSTREAM_NOT_FIND.
*/
String
UPSTREAM_NOT_FIND
=
"this can not rule upstream please check you configuration!"
;
/**
* The constant TOO_MANY_REQUESTS.
*/
String
TOO_MANY_REQUESTS
=
"the request is too fast please try again later"
;
/**
* The constant SIGN_IS_NOT_PASS.
*/
String
SIGN_IS_NOT_PASS
=
"sign is not pass,Please check you sign algorithm!"
;
/**
* The constant LINE_SEPARATOR.
*/
String
LINE_SEPARATOR
=
System
.
getProperty
(
"line.separator"
);
/**
* hystrix withExecutionIsolationSemaphoreMaxConcurrentRequests.
*/
int
MAX_CONCURRENT_REQUESTS
=
100
;
/**
* hystrix withCircuitBreakerErrorThresholdPercentage.
*/
int
ERROR_THRESHOLD_PERCENTAGE
=
50
;
/**
* hystrix withCircuitBreakerRequestVolumeThreshold.
*/
int
REQUEST_VOLUME_THRESHOLD
=
20
;
/**
* hystrix withCircuitBreakerSleepWindowInMilliseconds.
*/
int
SLEEP_WINDOW_INMILLISECONDS
=
5000
;
/**
* The constant TIME_OUT.
*/
long
TIME_OUT
=
3000
;
/**
* The constant COLONS.
*/
String
COLONS
=
":"
;
}
ydl-auth/ydl-auth-api/src/main/java/com/ydl/auth/apis/SignController.java
0 → 100644
View file @
af5fcf9f
package
com
.
ydl
.
ydlauth
.
apis
;
import
com.alibaba.dubbo.config.annotation.Reference
;
import
com.google.common.collect.Maps
;
import
com.ydl.auth.inf.AppAuthFacade
;
import
com.ydl.common.dto.BaseDtoResponse
;
import
com.ydl.common.helper.ResponseFormatterHelper
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.dromara.soul.common.constant.Constants
;
import
org.dromara.soul.web.request.RequestDTO
;
import
org.springframework.util.DigestUtils
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@RestController
@RequestMapping
(
value
=
"/sign"
)
@Api
(
description
=
"获取签名"
)
public
class
SignController
{
@Reference
(
version
=
"1.0.0"
)
private
AppAuthFacade
appAuthFacade
;
@RequestMapping
(
value
=
"/getAccessKey"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
value
=
"消息频道页消息列表"
)
public
BaseDtoResponse
<
String
>
getAccessKey
(
@RequestParam
(
value
=
"appSecret"
)
String
appKey
,
@RequestParam
(
value
=
"path"
)
String
path
)
throws
Exception
{
String
appSecret
=
appAuthFacade
.
getSecretByAppKey
(
appKey
);
Long
timeStamp
=
System
.
currentTimeMillis
();
String
version
=
"1.0.0"
;
Map
<
String
,
String
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"timestamp"
,
timeStamp
+
""
);
paramMap
.
put
(
"path"
,
path
);
paramMap
.
put
(
"version"
,
version
);
String
sign
=
generateSign
(
appSecret
,
paramMap
);
return
ResponseFormatterHelper
.
success
(
sign
);
}
public
String
generateSign
(
final
String
signKey
,
final
Map
<
String
,
String
>
params
)
{
List
<
String
>
storedKeys
=
Arrays
.
stream
(
params
.
keySet
()
.
toArray
(
new
String
[]{}))
.
sorted
(
Comparator
.
naturalOrder
())
.
collect
(
Collectors
.
toList
());
final
String
sign
=
storedKeys
.
stream
()
.
filter
(
key
->
!
Objects
.
equals
(
key
,
Constants
.
SIGN
))
.
map
(
key
->
String
.
join
(
""
,
key
,
params
.
get
(
key
)))
.
collect
(
Collectors
.
joining
()).
trim
()
.
concat
(
signKey
);
return
DigestUtils
.
md5DigestAsHex
(
sign
.
getBytes
()).
toUpperCase
();
}
private
Map
<
String
,
String
>
buildParamsMap
(
final
RequestDTO
dto
)
{
Map
<
String
,
String
>
map
=
Maps
.
newHashMapWithExpectedSize
(
3
);
map
.
put
(
Constants
.
TIMESTAMP
,
dto
.
getTimestamp
());
map
.
put
(
Constants
.
PATH
,
dto
.
getPath
());
map
.
put
(
Constants
.
VERSION
,
"1.0.0"
);
return
map
;
}
}
ydl-auth/ydl-auth-api/src/main/java/com/ydl/auth/dto/RequestDTO.java
0 → 100644
View file @
af5fcf9f
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
com
.
ydl
.
auth
.
dto
;
import
lombok.Data
;
import
org.apache.commons.lang3.StringUtils
;
import
org.dromara.soul.common.constant.Constants
;
import
org.dromara.soul.common.dto.MetaData
;
import
org.dromara.soul.common.enums.HttpMethodEnum
;
import
org.dromara.soul.common.enums.RpcTypeEnum
;
import
org.springframework.http.server.reactive.ServerHttpRequest
;
import
org.springframework.util.MultiValueMap
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.util.Objects
;
/**
* the soul request DTO .
*
* @author xiaoyu(Myth)
*/
@Data
public
class
RequestDTO
implements
Serializable
{
/**
* is module data.
*/
private
String
module
;
/**
* is method name .
*/
private
String
method
;
/**
* is rpcType data. now we only support "http","dubbo" "springCloud".
* {@linkplain RpcTypeEnum}
*/
private
String
rpcType
;
/**
* httpMethod now we only support "get","post" .
* {@linkplain HttpMethodEnum}
*/
private
String
httpMethod
;
/**
* this is sign .
*/
private
String
sign
;
/**
* timestamp .
*/
private
String
timestamp
;
/**
* appKey .
*/
private
String
appKey
;
/**
* path.
*/
private
String
path
;
/**
* the contextPath.
*/
private
String
contextPath
;
/**
* realUrl.
*/
private
String
realUrl
;
/**
* the metaData.
*/
private
MetaData
metaData
;
/**
* this is dubbo params.
*/
private
String
dubboParams
;
/**
* startDateTime.
*/
private
LocalDateTime
startDateTime
;
/**
* Transform map request dto.
*
* @param queryParams the query params
* @return the request dto
*/
public
static
RequestDTO
transformMap
(
final
MultiValueMap
<
String
,
String
>
queryParams
)
{
RequestDTO
requestDTO
=
new
RequestDTO
();
requestDTO
.
setModule
(
queryParams
.
getFirst
(
Constants
.
MODULE
));
requestDTO
.
setMethod
(
queryParams
.
getFirst
(
Constants
.
METHOD
));
requestDTO
.
setRpcType
(
queryParams
.
getFirst
(
Constants
.
RPC_TYPE
));
return
requestDTO
;
}
}
ydl-auth/ydl-auth-api/src/main/resources/application.yml
0 → 100644
View file @
af5fcf9f
server
:
port
:
8089
servlet
:
context-path
:
/advertise
spring
:
profiles
:
active
:
local
application
:
name
:
ydl-advertise-api
logging
:
file
:
/opt/release/logs/test/${spring.application.name}-DEBUG.log
level
:
root
:
debug
com.ydl
:
debug
web
:
debug
#原始数据kafka读取
kafka
:
consumer
:
servers
:
47.111.174.49:9091
enable
:
auto
:
commit
:
true
interval
:
100
offset
:
reset
:
latest
topic
:
maidian_topic
session
:
timeout
:
20000
producer
:
servers
:
47.111.174.49:9091
maidianTopic
:
nontrace_maidian_topic
retries
:
0
batch
:
size
:
4096
linger
:
1
buffer
:
memory
:
40960
---
spring
:
profiles
:
local
dubbo
:
application
:
name
:
ydl-advertise-api
registry
:
id
:
zookeeper
#address: zookeeper://127.0.0.1:2181
address
:
zookeeper://47.97.49.44:2181?backup=47.97.49.44:2182,47.97.49.44:2183
protocol
:
zookeeper
---
spring
:
profiles
:
dev
dubbo
:
application
:
name
:
ydl-advertise-api
registry
:
id
:
zookeeper
#address: zookeeper://127.0.0.1:2181
address
:
zookeeper://47.97.49.44:2181?backup=47.97.49.44:2182,47.97.49.44:2183
#address: zookeeper://172.16.1.34:2181?backup=172.16.226.95:2181,172.16.197.219:2181
protocol
:
zookeeper
kafka
:
producer
:
servers
:
47.111.174.49:9091
---
spring
:
profiles
:
pre
dubbo
:
application
:
name
:
ydl-advertise-api
registry
:
id
:
zookeeper
address
:
zookeeper://172.16.1.34:2181?backup=172.16.226.95:2181,172.16.197.219:2181
protocol
:
zookeeper
kafka
:
producer
:
servers
:
172.16.65.81:9091,172.16.65.81:9092,172.16.65.81:9093
---
spring
:
profiles
:
prod
dubbo
:
application
:
name
:
ydl-advertise-api
registry
:
id
:
zookeeper
address
:
zookeeper://172.16.1.34:2181?backup=172.16.226.95:2181,172.16.197.219:2181
protocol
:
zookeeper
logging
:
file
:
/opt/release/logs/prod/${spring.application.name}-DEBUG.log
level
:
root
:
debug
com.ydl
:
debug
web
:
debug
baidu
:
app
:
upload
:
url
:
https://ocpc.baidu.com/rhine/app/upload
ad
:
tooken
:
jRvLjRUukcR61nzcYFWmwOufyYcYSPOU@S5W6ZISKpvXabnwiS6Lb4MYSZmQDgyRT
redis
:
host-name
:
10.24.253.1
port
:
7389
elasticsearch
:
cluster-name
:
elasticsearch
cluster-nodes
:
localhost:9300
kafka
:
producer
:
servers
:
172.16.65.81:9091,172.16.65.81:9092,172.16.65.81:9093
\ No newline at end of file
ydl-auth/ydl-auth-inf/pom.xml
0 → 100644
View file @
af5fcf9f
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
ydl-auth
</artifactId>
<groupId>
com.ydl
</groupId>
<version>
0.0.1-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
ydl-auth-inf
</artifactId>
</project>
\ No newline at end of file
ydl-auth/ydl-auth-inf/src/main/java/com/ydl/auth/inf/AppAuthFacade.java
0 → 100644
View file @
af5fcf9f
package
com
.
ydl
.
auth
.
inf
;
public
interface
AppAuthFacade
{
}
ydl-auth/ydl-auth-inf/src/main/java/com/ydl/auth/po/AppAuth.java
0 → 100644
View file @
af5fcf9f
package
com
.
ydl
.
auth
.
dto
;
import
lombok.Data
;
@Data
public
class
AppAuth
{
private
Long
id
;
private
String
appKey
;
private
String
appSecret
;
private
String
userId
;
private
String
phone
;
private
String
extInfo
;
private
Byte
enabled
;
private
Long
dateCreated
;
private
Long
dateUpdated
;
}
ydl-auth/ydl-auth-inf/src/main/java/com/ydl/auth/po/rsp/AppAuthRsp.java
0 → 100644
View file @
af5fcf9f
package
com
.
ydl
.
auth
.
dto
.
rsp
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
AppAuthRsp
implements
Serializable
{
private
Long
id
;
private
String
appKey
;
private
String
appSecret
;
private
String
userId
;
private
String
phone
;
private
String
extInfo
;
private
Byte
enabled
;
}
ydl-auth/ydl-auth-service/pom.xml
0 → 100644
View file @
af5fcf9f
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
ydl-auth
</artifactId>
<groupId>
com.ydl
</groupId>
<version>
0.0.1-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
ydl-auth-service
</artifactId>
</project>
\ No newline at end of file
ydl-auth/ydl-auth-service/src/main/java/com/ydl/auth/service/YdlAuthServiceApplication.java
0 → 100644
View file @
af5fcf9f
package
com
.
ydl
.
auth
.
service
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
@SpringBootApplication
@Slf4j
@ComponentScan
({
"com.ydl"
})
@EnableScheduling
public
class
AuthServiceApplication
{
public
static
void
main
(
String
[]
args
)
{
try
{
SpringApplication
.
run
(
AuthServiceApplication
.
class
,
args
);
}
catch
(
Throwable
e
)
{
log
.
error
(
""
,
e
);
}
}
}
\ No newline at end of file
ydl-auth/ydl-auth-service/src/main/java/com/ydl/auth/service/biz/AppAuthBiz.java
0 → 100644
View file @
af5fcf9f
package
com
.
ydl
.
auth
.
service
.
biz
;
public
interface
AppAuthBiz
{
}
ydl-auth/ydl-auth-service/src/main/java/com/ydl/auth/service/biz/impl/AppAuthBizImpl.java
0 → 100644
View file @
af5fcf9f
package
com
.
ydl
.
auth
.
service
.
biz
.
impl
;
public
class
AppAuthBizImpl
{
}
ydl-auth/ydl-auth-service/src/main/java/com/ydl/auth/service/config/MybatisConfig.java
0 → 100644
View file @
af5fcf9f
package
com
.
ydl
.
auth
.
service
.
config
;
import
com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig
;
import
com.ydl.dbprovider.rds.config.BaseBatisConfig
;
import
com.ydl.dbprovider.rds.config.DbConnectionProperties
;
import
com.ydl.dbprovider.rds.source.DataSourceConfiguration
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
tk.mybatis.spring.annotation.MapperScan
;
/**
* Created by yubgou on ${2018年03月20日15:45:02}.
*/
@Configuration
@MapperScan
(
"com.ydl.*.service.dao"
)
@EnableApolloConfig
(
value
=
{
"db-switch.properties"
,
"ydl-datasource.yml"
})
//从配置中心取配置文件
public
class
MybatisConfig
extends
BaseBatisConfig
{
@Bean
(
"dbConnectionProperties"
)
public
DbConnectionProperties
dbConnectionProperties
(){
DbConnectionProperties
dbConnectionProperties
=
new
DbConnectionProperties
();
dbConnectionProperties
.
setMapperLocations
(
"classpath*:sqlmap/*Mapper.xml"
);
dbConnectionProperties
.
setAliasesPackage
(
"com.ydl.**.po"
);
dbConnectionProperties
.
setDatabaseName
(
"ydl_cooperation"
);
return
dbConnectionProperties
;
}
@Bean
@ConfigurationProperties
(
prefix
=
"spring.datasource"
)
public
DataSourceConfiguration
dataSourceConfiguration
()
{
return
new
DataSourceConfiguration
();
}
}
\ No newline at end of file
ydl-auth/ydl-auth-service/src/main/java/com/ydl/auth/service/config/source/DataSourceConfig.java
0 → 100644
View file @
af5fcf9f
package
com
.
ydl
.
auth
.
service
.
config
.
source
;
import
com.alibaba.druid.pool.DruidDataSource
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.core.env.Environment
;
/**
* Created by ${汪梓文} on ${2018年03月20日15:45:02}.
*/
@Configuration
@EnableConfigurationProperties
({
DataSourceProps
.
class
})
public
class
DataSourceConfig
{
private
final
DataSourceProps
sourceProps
;
private
final
Environment
environment
;
@Autowired
public
DataSourceConfig
(
DataSourceProps
sourceProps
,
Environment
environment
)
{
this
.
sourceProps
=
sourceProps
;
this
.
environment
=
environment
;
}
@Bean
public
DruidDataSource
druidDataSource
()
{
DruidDataSource
druidDataSource
=
new
DruidDataSource
();
druidDataSource
.
setUrl
(
sourceProps
.
getJdbcUrl
());
druidDataSource
.
setUsername
(
sourceProps
.
getUserName
());
druidDataSource
.
setPassword
(
sourceProps
.
getPassword
());
druidDataSource
.
setDriverClassName
(
sourceProps
.
getDriverClassName
());
return
druidDataSource
;
}
}
ydl-auth/ydl-auth-service/src/main/java/com/ydl/auth/service/config/source/DataSourceProps.java
0 → 100644
View file @
af5fcf9f
package
com
.
ydl
.
auth
.
service
.
config
.
source
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
/**
* Created by ${汪梓文} on ${2018年03月20日15:45:02}.
*/
@ConfigurationProperties
(
"druid.pool"
)
public
class
DataSourceProps
{
private
String
userName
;
private
String
password
;
private
String
jdbcUrl
;
private
String
driverClassName
;
public
String
getUserName
()
{
return
userName
;
}
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
String
getJdbcUrl
()
{
return
jdbcUrl
;
}
public
void
setJdbcUrl
(
String
jdbcUrl
)
{
this
.
jdbcUrl
=
jdbcUrl
;
}
public
String
getDriverClassName
()
{
return
driverClassName
;
}
public
void
setDriverClassName
(
String
driverClassName
)
{
this
.
driverClassName
=
driverClassName
;
}
}
ydl-auth/ydl-auth-service/src/main/java/com/ydl/auth/service/dao/AppAuthMapper.java
0 → 100644
View file @
af5fcf9f
package
com
.
ydl
.
auth
.
service
.
dao
;
public
class
AppAuthMapper
{
}
ydl-auth/ydl-auth-service/src/main/java/com/ydl/auth/service/facade/AppAuthFacadeImpl.java
0 → 100644
View file @
af5fcf9f
package
com
.
ydl
.
auth
.
service
.
facade
;
public
class
AppAuthFacadeImpl
{
}
ydl-auth/ydl-auth-service/src/main/resources/application.yml
0 → 100644
View file @
af5fcf9f
server
:
port
:
8089
servlet
:
context-path
:
/ydlAuth
spring
:
profiles
:
active
:
local
application
:
name
:
ydl-auth-api
logging
:
file
:
/opt/release/logs/test/${spring.application.name}-DEBUG.log
level
:
root
:
debug
com.ydl
:
debug
web
:
debug
---
spring
:
profiles
:
local
dubbo
:
application
:
name
:
ydl-auth-api
registry
:
id
:
zookeeper
#address: zookeeper://127.0.0.1:2181
address
:
zookeeper://47.97.49.44:2181?backup=47.97.49.44:2182,47.97.49.44:2183
protocol
:
zookeeper
---
spring
:
profiles
:
dev
dubbo
:
application
:
name
:
ydl-auth-api
registry
:
id
:
zookeeper
#address: zookeeper://127.0.0.1:2181
address
:
zookeeper://47.97.49.44:2181?backup=47.97.49.44:2182,47.97.49.44:2183
#address: zookeeper://172.16.1.34:2181?backup=172.16.226.95:2181,172.16.197.219:2181
protocol
:
zookeeper
kafka
:
producer
:
servers
:
47.111.174.49:9091
---
spring
:
profiles
:
pre
dubbo
:
application
:
name
:
ydl-auth-api
registry
:
id
:
zookeeper
address
:
zookeeper://172.16.1.34:2181?backup=172.16.226.95:2181,172.16.197.219:2181
protocol
:
zookeeper
---
spring
:
profiles
:
prod
dubbo
:
application
:
name
:
ydl-auth-api
registry
:
id
:
zookeeper
address
:
zookeeper://172.16.1.34:2181?backup=172.16.226.95:2181,172.16.197.219:2181
protocol
:
zookeeper
logging
:
file
:
/opt/release/logs/prod/${spring.application.name}-DEBUG.log
level
:
root
:
debug
com.ydl
:
debug
web
:
debug
ydl-auth/ydl-auth-service/src/main/resources/sqlmap/AppAuthMapper.xml
0 → 100644
View file @
af5fcf9f
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