Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-demo-single
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
gic_demo
gic-demo-single
Commits
6609cd3d
You need to sign in or sign up before continuing.
Commit
6609cd3d
authored
Jun 18, 2019
by
朱瑞泽
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码调整
parent
6ebc95d2
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
165 additions
and
1 deletions
+165
-1
pom.xml
gic-demo-single-service/pom.xml
+27
-0
pom.xml
gic-demo-single-web/pom.xml
+33
-0
Main.java
...ingle-web/src/main/java/com/gic/demo/single/web/Main.java
+11
-1
AuthcenterTestController.java
.../demo/single/web/controller/AuthcenterTestController.java
+40
-0
DemoProjectController.java
...gic/demo/single/web/controller/DemoProjectController.java
+2
-0
application.yml
gic-demo-single-web/src/main/resources/application.yml
+2
-0
log4j2.xml
gic-demo-single-web/src/main/resources/log4j2.xml
+27
-0
GicAuthcenterTest.java
...o-single-web/src/test/java/com/gic/GicAuthcenterTest.java
+23
-0
No files found.
gic-demo-single-service/pom.xml
View file @
6609cd3d
...
...
@@ -159,6 +159,33 @@
</configuration>
</plugin>
<plugin>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
flatten-maven-plugin
</artifactId>
<version>
1.1.0
</version>
<configuration>
<flattenMode>
defaults
</flattenMode>
</configuration>
<executions>
<!-- enable flattening -->
<execution>
<id>
flatten
</id>
<phase>
process-resources
</phase>
<goals>
<goal>
flatten
</goal>
</goals>
</execution>
<!-- ensure proper cleanup -->
<execution>
<id>
flatten.clean
</id>
<phase>
clean
</phase>
<goals>
<goal>
clean
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
gic-demo-single-web/pom.xml
View file @
6609cd3d
...
...
@@ -97,6 +97,12 @@
<version>
1.23
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-authcenter-inner-sdk
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
</dependencies>
<build>
...
...
@@ -137,6 +143,33 @@
</configuration>
</plugin>
<plugin>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
flatten-maven-plugin
</artifactId>
<version>
1.1.0
</version>
<configuration>
<flattenMode>
defaults
</flattenMode>
</configuration>
<executions>
<!-- enable flattening -->
<execution>
<id>
flatten
</id>
<phase>
process-resources
</phase>
<goals>
<goal>
flatten
</goal>
</goals>
</execution>
<!-- ensure proper cleanup -->
<execution>
<id>
flatten.clean
</id>
<phase>
clean
</phase>
<goals>
<goal>
clean
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
gic-demo-single-web/src/main/java/com/gic/demo/single/web/Main.java
View file @
6609cd3d
...
...
@@ -3,6 +3,9 @@ package com.gic.demo.single.web;
import
com.gic.dubbo.util.DubboContextUtil
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration
;
import
org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration
;
import
org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.context.annotation.ImportResource
;
...
...
@@ -11,7 +14,14 @@ import org.springframework.context.annotation.ImportResource;
*
* @author zhurz
*/
@SpringBootApplication
@SpringBootApplication
(
scanBasePackages
=
"com.gic"
,
exclude
=
{
RedisAutoConfiguration
.
class
,
RedisRepositoriesAutoConfiguration
.
class
,
QuartzAutoConfiguration
.
class
}
)
@ImportResource
(
value
=
{
"classpath*:applicationContext-init.xml"
,
"classpath*:dubbo-setting.xml"
,
...
...
gic-demo-single-web/src/main/java/com/gic/demo/single/web/controller/AuthcenterTestController.java
0 → 100644
View file @
6609cd3d
package
com
.
gic
.
demo
.
single
.
web
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.authcenter.sdk.GicAuthcenterManager
;
import
com.gic.authcenter.sdk.exception.NoTokenCacheException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* GIC 认证中心 SDK 测试
*
* @author zhurz
*/
@RestController
public
class
AuthcenterTestController
{
@Autowired
private
GicAuthcenterManager
gicAuthcenterManager
;
@RequestMapping
(
"/get-authcenter-url"
)
public
String
getAuthcenterUrl
()
{
return
JSON
.
toJSONString
(
gicAuthcenterManager
.
getAuthorizeUrl
());
}
@RequestMapping
(
"/authcenter-code-callback"
)
public
String
authcenterCodeCallback
(
String
code
)
{
return
JSON
.
toJSONString
(
gicAuthcenterManager
.
processCode
(
code
));
}
@RequestMapping
(
"/get-user-details"
)
public
String
getUserDetails
(
Integer
id
)
{
try
{
return
JSON
.
toJSONString
(
gicAuthcenterManager
.
getUserDetails
(
id
));
}
catch
(
NoTokenCacheException
e
)
{
return
"无 token 缓存"
;
}
}
}
gic-demo-single-web/src/main/java/com/gic/demo/single/web/controller/DemoProjectController.java
View file @
6609cd3d
...
...
@@ -48,4 +48,5 @@ public class DemoProjectController {
logger
.
warn
(
"获取门店信息异常 -> {} -> {}"
,
storeId
,
response
.
getMessage
());
return
GicDemoErrCode
.
ERR_1
.
buildFailureResponse
();
}
}
\ No newline at end of file
gic-demo-single-web/src/main/resources/application.yml
View file @
6609cd3d
...
...
@@ -15,3 +15,5 @@ spring:
charset
:
UTF-8
enabled
:
true
force
:
true
main
:
allow-bean-definition-overriding
:
true
gic-demo-single-web/src/main/resources/log4j2.xml
0 → 100644
View file @
6609cd3d
<?xml version="1.0" encoding="UTF-8"?>
<configuration
status=
"error"
packages=
"com.gic.commons.log"
>
<appenders>
<!--这个输出控制台的配置-->
<Console
name=
"Console"
target=
"SYSTEM_OUT"
>
<!--控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch)-->
<ThresholdFilter
level=
"trace"
onMatch=
"ACCEPT"
onMismatch=
"DENY"
/>
<!--这个都知道是输出日志的格式-->
<PatternLayout
pattern=
"%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c:%L] [%traceId] %m%n"
/>
</Console>
</appenders>
<loggers>
<!--建立一个默认的root的logger-->
<Logger
name=
"com.gic"
level=
"DEBUG"
/>
<Logger
name=
"org.springframework"
level=
"INFO"
/>
<logger
name=
"Sharding-JDBC-SQL"
level=
"INFO"
/>
<logger
name=
"org.hibernate.SQL"
level=
"DEBUG"
/>
<logger
name=
"org.hibernate.type.descriptor.sql.BasicBinder"
level=
"DEBUG"
/>
<Root
level=
"WARN"
>
<!-- <Root level="DEBUG">-->
<AppenderRef
ref=
"Console"
/>
</Root>
</loggers>
</configuration>
gic-demo-single-web/src/test/java/com/gic/GicAuthcenterTest.java
0 → 100644
View file @
6609cd3d
package
com
.
gic
;
import
com.gic.authcenter.sdk.GicAuthcenter
;
import
com.gic.authcenter.sdk.config.GicAuthcenterConfig
;
import
org.junit.Test
;
/**
* @author zhurz
*/
public
class
GicAuthcenterTest
{
@Test
public
void
test
()
{
GicAuthcenter
gicAuthcenter
=
GicAuthcenter
.
build
(
GicAuthcenterConfig
.
build
(
"gicplatformid"
,
"gicplatformsecret"
,
"http://127.0.0.1:9002/gic-demo-single-web/demo/get-access-token"
,
"https://www.gicdev.com/gic-authcenter"
));
System
.
out
.
println
(
gicAuthcenter
.
getAuthorizeUrl
());
}
}
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