http-service: use spring externalized configuration for oauth id/secret
This commit is contained in:
@@ -59,18 +59,6 @@ public class SpringBootWebApplication extends SpringBootServletInitializer
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean("OAuth Client ID")
|
|
||||||
String oauthClientId() throws NamingException
|
|
||||||
{
|
|
||||||
return (String) getContext().lookup("runelite-oauth-client-id");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean("OAuth Client Secret")
|
|
||||||
String oauthClientSecret() throws NamingException
|
|
||||||
{
|
|
||||||
return (String) getContext().lookup("runelite-oauth-client-secret");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -97,8 +98,8 @@ public class AccountService
|
|||||||
@Autowired
|
@Autowired
|
||||||
public AccountService(
|
public AccountService(
|
||||||
@Qualifier("Runelite SQL2O") Sql2o sql2o,
|
@Qualifier("Runelite SQL2O") Sql2o sql2o,
|
||||||
@Qualifier("OAuth Client ID") String oauthClientId,
|
@Value("${oauth.client-id}") String oauthClientId,
|
||||||
@Qualifier("OAuth Client Secret") String oauthClientSecret,
|
@Value("${oauth.client-secret}") String oauthClientSecret,
|
||||||
AuthFilter auth
|
AuthFilter auth
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,18 +48,6 @@ public class SpringBootWebApplicationTest
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean("OAuth Client ID")
|
|
||||||
String oauthClientId()
|
|
||||||
{
|
|
||||||
return "moo";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean("OAuth Client Secret")
|
|
||||||
String oauthClientSecret()
|
|
||||||
{
|
|
||||||
return "moo2";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore
|
@Ignore
|
||||||
public void test() throws InterruptedException
|
public void test() throws InterruptedException
|
||||||
|
|||||||
2
http-service/src/test/resources/application.properties
Normal file
2
http-service/src/test/resources/application.properties
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
oauth.client-id=moo
|
||||||
|
oauth.client-secret=cow
|
||||||
Reference in New Issue
Block a user