You need to sign in or sign up before continuing.
Commit 6609cd3d by 朱瑞泽

代码调整

parent 6ebc95d2
......@@ -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>
......@@ -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>
......@@ -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",
......
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 缓存";
}
}
}
......@@ -48,4 +48,5 @@ public class DemoProjectController {
logger.warn("获取门店信息异常 -> {} -> {}", storeId, response.getMessage());
return GicDemoErrCode.ERR_1.buildFailureResponse();
}
}
\ No newline at end of file
......@@ -15,3 +15,5 @@ spring:
charset: UTF-8
enabled: true
force: true
main:
allow-bean-definition-overriding: true
<?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>
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());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment