Skip to content

Commit 8704a2f

Browse files
committed
docs: auth configuration override examlple
1 parent eafc5fe commit 8704a2f

3 files changed

Lines changed: 67 additions & 2 deletions

File tree

src/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ services:
55
dockerfile: server-rm/Dockerfile
66
ports:
77
- "127.0.0.1:8800:8080"
8+
# volumes:
9+
# - ./oslcOAuthStore.xml:/var/lib/jetty/oslcOAuthStore.xml:ro
810
# Uncomment to configure the base URL for reverse proxy or custom domain deployments
911
# environment:
1012
# - LYO_BASEURL=https://mytoolchain.example.com:9443/refimpl/rm

src/oslcOAuthStore.xml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<rdf:RDF
3+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
4+
xmlns:oauth="http://eclipse.org/lyo/server/oauth#">
5+
6+
<!-- Sample OAuth 1.0a Consumer for a web application -->
7+
<rdf:Description>
8+
<rdf:type rdf:resource="http://eclipse.org/lyo/server/oauth#Consumer"/>
9+
<oauth:consumerKey>web-app-consumer</oauth:consumerKey>
10+
<oauth:consumerSecret>d2ViLWFwcC1zZWNyZXQtYTFiMmMzZDRlNWY2ZzdoOGk5ajA=</oauth:consumerSecret>
11+
<oauth:consumerName>Web Application Client</oauth:consumerName>
12+
<oauth:trusted>false</oauth:trusted>
13+
<oauth:provisional>false</oauth:provisional>
14+
</rdf:Description>
15+
16+
<!-- Sample OAuth 1.0a Consumer for a mobile application -->
17+
<rdf:Description>
18+
<rdf:type rdf:resource="http://eclipse.org/lyo/server/oauth#Consumer"/>
19+
<oauth:consumerKey>mobile-app-consumer</oauth:consumerKey>
20+
<oauth:consumerSecret>bW9iaWxlLWFwcC1zZWNyZXQtazlsOG03bjZvNXA0cTNyMnMxdDA=</oauth:consumerSecret>
21+
<oauth:consumerName>Mobile Application Client</oauth:consumerName>
22+
<oauth:trusted>false</oauth:trusted>
23+
<oauth:provisional>false</oauth:provisional>
24+
</rdf:Description>
25+
26+
<!-- Sample trusted OAuth 1.0a Consumer for automated systems -->
27+
<rdf:Description>
28+
<rdf:type rdf:resource="http://eclipse.org/lyo/server/oauth#Consumer"/>
29+
<oauth:consumerKey>automation-consumer</oauth:consumerKey>
30+
<oauth:consumerSecret>YXV0b21hdGlvbi1zZWNyZXQtdTF2Mncza3g0eTV6NmE3YjhjOWQw</oauth:consumerSecret>
31+
<oauth:consumerName>Automation Service</oauth:consumerName>
32+
<oauth:trusted>true</oauth:trusted>
33+
<oauth:provisional>false</oauth:provisional>
34+
</rdf:Description>
35+
36+
<!-- Sample provisional consumer for development/testing -->
37+
<rdf:Description>
38+
<rdf:type rdf:resource="http://eclipse.org/lyo/server/oauth#Consumer"/>
39+
<oauth:consumerKey>dev-test-consumer</oauth:consumerKey>
40+
<oauth:consumerSecret>ZGV2LXRlc3Qtc2VjcmV0LWUxZjJnM2g0aTVqNms3bDhtOW4w</oauth:consumerSecret>
41+
<oauth:consumerName>Development Test Client</oauth:consumerName>
42+
<oauth:trusted>false</oauth:trusted>
43+
<oauth:provisional>true</oauth:provisional>
44+
</rdf:Description>
45+
46+
</rdf:RDF>

src/server-rm/src/main/java/co/oslc/refimpl/rm/gen/auth/AuthenticationApplication.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,28 @@ public static AuthenticationApplication getApplication() {
101101
// End of user code
102102
return authenticationApplication;
103103
}
104-
104+
105+
/**
106+
* Returns filename for the auth configuration; warns and returns null if missing
107+
*/
105108
public String getOslcConsumerStoreFilename() {
109+
if (oslcConsumerStoreFilename == null) {
110+
log.warn("OSLC Consumer Store filename is null");
111+
return null;
112+
}
113+
114+
java.nio.file.Path absolutePath =
115+
java.nio.file.Paths.get(oslcConsumerStoreFilename).toAbsolutePath();
116+
log.debug("OSLC Consumer Store filename - relative: {}, absolute: {}",
117+
oslcConsumerStoreFilename, absolutePath);
118+
119+
if (!java.nio.file.Files.exists(absolutePath)) {
120+
log.warn("OSLC Consumer Store file does not exist: {}", absolutePath);
121+
}
122+
106123
return oslcConsumerStoreFilename;
107124
}
108-
125+
109126
@Override
110127
public String getName() {
111128
// Display name for this application.

0 commit comments

Comments
 (0)