You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2024/09/19 16:10:10 UTC
(sling-samples) branch master updated (c70d15e -> 6c69c79)
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/sling-samples.git
from c70d15e SLING-12094 - Use GitHub for the Maven scm.url value
new 50f8ae2 oauth: import after archetype generation
new da759fb feat: working on end-to-end flow
new d38672a feat: styling using Tailwind CSS
new 58b61d9 chore: remove outdated comment
new f537438 feat: display data from youtube searches
new e643368 feat: simplify HTML/CSS with @apply
new cc2a54e feat: allow searching for the youtube page
new ea450e7 fix: only render parts of the videos page when they have content
new ccd1046 fix: rebuild css if any of the involved files change
new 8147f41 feat: extend styling of the videos page
new 46ddf66 chore: adapt servlet to latest upstream changes
new c32b409 feat(oauth): configure secrets
new 33e5688 chore(oauth): adapt to upstream changes
new ef3f196 chore(oauth): stop printing responses to stdout
new 6c69c79 chore(oauth): configure the JcrUserHomeOAuthTokenStore
The 15 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
oauth/.gitignore | 2 +
oauth/README.md | 133 +
oauth/all/pom.xml | 105 +
oauth/core/pom.xml | 179 ++
.../org/apache/sling/samples/oauth_demo/Error.java | 9 +
.../sling/samples/oauth_demo/ErrorDetail.java | 7 +
.../org/apache/sling/samples/oauth_demo/Id.java | 6 +
.../org/apache/sling/samples/oauth_demo/Item.java | 8 +
.../apache/sling/samples/oauth_demo/PageInfo.java | 6 +
.../apache/sling/samples/oauth_demo/Snippet.java | 12 +
.../apache/sling/samples/oauth_demo/Thumbnail.java | 7 +
.../sling/samples/oauth_demo/Thumbnails.java | 9 +
.../samples/oauth_demo/YoutubeSearchResponse.java | 13 +
.../samples/oauth_demo/YoutubeVideosModel.java | 26 +-
.../samples/oauth_demo/impl/YoutubeHttpClient.java | 54 +
.../oauth_demo/impl/YoutubeSearchServlet.java | 78 +
.../sling/samples/oauth_demo/package-info.java | 8 +-
oauth/launcher/Makefile | 39 +
oauth/launcher/pom.xml | 118 +
oauth/launcher/src/main/features/launcher.json | 28 +
oauth/pom.xml | 2740 ++++++++++++++++++++
oauth/ui.apps/Makefile | 5 +
oauth/ui.apps/pom.xml | 65 +
.../src/main/content/META-INF/vault/filter.xml | 39 +
.../src/main/content/META-INF/vault/settings.xml | 17 +
.../content/jcr_root/apps/oauth-demo/.content.xml | 29 +-
.../apps/oauth-demo/components/.content.xml | 27 +-
.../oauth-demo/components/welcome/.content.xml | 27 +-
.../oauth-demo/components/welcome/welcome.html | 14 +
.../components/youtube-videos/.content.xml | 27 +-
.../oauth-demo/components/youtube-videos/show.html | 36 +
.../jcr_root/apps/oauth-demo/install/.content.xml | 28 +-
.../jcr_root/content/oauth-demo/.content.xml | 29 +-
.../content/oauth-demo/static/css/output.css | 899 +++++++
.../content/oauth-demo/videos/.content.xml | 29 +-
oauth/ui.apps/src/main/frontend/input.css | 26 +
oauth/ui.apps/tailwind.config.js | 11 +
37 files changed, 4733 insertions(+), 162 deletions(-)
create mode 100644 oauth/.gitignore
create mode 100644 oauth/README.md
create mode 100644 oauth/all/pom.xml
create mode 100644 oauth/core/pom.xml
create mode 100644 oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Error.java
create mode 100644 oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/ErrorDetail.java
create mode 100644 oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Id.java
create mode 100644 oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Item.java
create mode 100644 oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/PageInfo.java
create mode 100644 oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Snippet.java
create mode 100644 oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Thumbnail.java
create mode 100644 oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Thumbnails.java
create mode 100644 oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/YoutubeSearchResponse.java
copy slingbucks/src/main/java/org/apache/sling/slingbucks/server/SlingbucksConstants.java => oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/YoutubeVideosModel.java (61%)
create mode 100644 oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeHttpClient.java
create mode 100644 oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeSearchServlet.java
copy DEPRECATED/espblog/src/main/resources/initial-content/apps/espblog/constants.esp => oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/package-info.java (89%)
create mode 100644 oauth/launcher/Makefile
create mode 100644 oauth/launcher/pom.xml
create mode 100644 oauth/launcher/src/main/features/launcher.json
create mode 100644 oauth/pom.xml
create mode 100644 oauth/ui.apps/Makefile
create mode 100644 oauth/ui.apps/pom.xml
create mode 100644 oauth/ui.apps/src/main/content/META-INF/vault/filter.xml
create mode 100644 oauth/ui.apps/src/main/content/META-INF/vault/settings.xml
copy fling/src/main/resources/assets/css/fling.css => oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/.content.xml (73%)
copy fling/src/main/resources/assets/css/fling.css => oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/.content.xml (80%)
copy fling/src/main/resources/assets/css/fling.css => oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/.content.xml (80%)
create mode 100644 oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/welcome.html
copy fling/src/main/resources/assets/css/fling.css => oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/.content.xml (80%)
create mode 100644 oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
copy fling/src/main/resources/assets/css/fling.css => oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/install/.content.xml (77%)
copy fling/src/main/resources/assets/css/fling.css => oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/.content.xml (72%)
create mode 100644 oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/static/css/output.css
copy fling/src/main/resources/assets/css/fling.css => oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/videos/.content.xml (72%)
create mode 100644 oauth/ui.apps/src/main/frontend/input.css
create mode 100644 oauth/ui.apps/tailwind.config.js
(sling-samples) 09/15: fix: rebuild css if any of the involved files change
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-samples.git
commit ccd1046edc5b2a8fdbe1a2c9fa550087d1f7ed12
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Tue Sep 10 18:15:55 2024 +0200
fix: rebuild css if any of the involved files change
---
oauth/ui.apps/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/oauth/ui.apps/Makefile b/oauth/ui.apps/Makefile
index 8633602..53fbd0e 100644
--- a/oauth/ui.apps/Makefile
+++ b/oauth/ui.apps/Makefile
@@ -1,5 +1,5 @@
css: src/main/content/jcr_root/content/oauth-demo/static/css/output.css
.PHONY=css
-src/main/content/jcr_root/content/oauth-demo/static/css/output.css: src/main/frontend/input.css
+src/main/content/jcr_root/content/oauth-demo/static/css/output.css: src/main/frontend/input.css tailwind.config.js src/main/content/jcr_root/apps/oauth-demo/components/welcome/welcome.html src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
tailwindcss --input $< --output $@
(sling-samples) 05/15: feat: display data from youtube searches
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-samples.git
commit f537438d371d97242b5f86e19425ec45f6c63144
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Tue Sep 10 14:55:12 2024 +0200
feat: display data from youtube searches
---
.../oauth-demo/components/youtube-videos/show.html | 10 +++++++++
.../content/oauth-demo/static/css/output.css | 26 ++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
index 8e808af..44bebf5 100644
--- a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
+++ b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
@@ -11,6 +11,16 @@
<h1 class="text-3xl mb-4 font-bold">Search results</h1>
<p class="mb-4">ERROR? ${youtube.response.error.message}</p>
<p class="mb-4">Got ${youtube.response.items.size} results of out total ${youtube.response.pageInfo.totalResults}</p>
+ <div data-sly-list.item="${youtube.response.items}"
+ class="flex flex-row flex-wrap">
+ <div class="basis-1/3 px-4">
+ <a href="https://www.youtube.com/watch?v=${item.id.videoId}" target="_blank">
+ <h2 class="mb-4 text-xl font-bold">${item.snippet.title}</h2>
+ <img src="${item.snippet.thumbnails.medium.url}" alt="${item.snippet.title}">
+ <p class="mb-4">${item.snippet.description}</p>
+ </a>
+ </div>
+ </div>
</div>
</body>
</html>
\ No newline at end of file
diff --git a/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/static/css/output.css b/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/static/css/output.css
index 6bd198e..db15688 100644
--- a/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/static/css/output.css
+++ b/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/static/css/output.css
@@ -602,6 +602,22 @@ video {
margin-bottom: 1rem;
}
+.flex {
+ display: flex;
+}
+
+.basis-1\/3 {
+ flex-basis: 33.333333%;
+}
+
+.flex-row {
+ flex-direction: row;
+}
+
+.flex-wrap {
+ flex-wrap: wrap;
+}
+
.rounded {
border-radius: 0.25rem;
}
@@ -620,11 +636,21 @@ video {
padding: 2rem;
}
+.px-4 {
+ padding-left: 1rem;
+ padding-right: 1rem;
+}
+
.text-3xl {
font-size: 1.875rem;
line-height: 2.25rem;
}
+.text-xl {
+ font-size: 1.25rem;
+ line-height: 1.75rem;
+}
+
.font-bold {
font-weight: 700;
}
(sling-samples) 14/15: chore(oauth): stop printing responses to stdout
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-samples.git
commit ef3f19696162a51e75c3c262c638e8e0e55a9658
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Thu Sep 19 15:03:01 2024 +0200
chore(oauth): stop printing responses to stdout
---
.../org/apache/sling/samples/oauth_demo/impl/YoutubeHttpClient.java | 2 --
1 file changed, 2 deletions(-)
diff --git a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeHttpClient.java b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeHttpClient.java
index fe153ce..54cbc56 100644
--- a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeHttpClient.java
+++ b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeHttpClient.java
@@ -47,8 +47,6 @@ public class YoutubeHttpClient {
String body = response.body();
- System.out.println(body);
-
ObjectMapper mapper = new ObjectMapper();
return mapper.reader().readValue(body, YoutubeSearchResponse.class);
}
(sling-samples) 11/15: chore: adapt servlet to latest upstream changes
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-samples.git
commit 46ddf668477f757fe71407d45850a645d5e83997
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Tue Sep 10 19:00:02 2024 +0200
chore: adapt servlet to latest upstream changes
---
.../oauth_demo/impl/YoutubeSearchServlet.java | 22 +---------------------
1 file changed, 1 insertion(+), 21 deletions(-)
diff --git a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeSearchServlet.java b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeSearchServlet.java
index beac6e4..da3ff43 100644
--- a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeSearchServlet.java
+++ b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeSearchServlet.java
@@ -42,15 +42,10 @@ import org.osgi.service.component.annotations.Reference;
public class YoutubeSearchServlet extends OAuthEnabledSlingServlet {
private static final long serialVersionUID = 1L;
- private final OidcConnection connection;
- private OidcTokenStore tokenStore;
- private OidcClient oidcClient;
@Activate
public YoutubeSearchServlet(@Reference OidcConnection connection, @Reference OidcTokenStore tokenStore, @Reference OidcClient oidcClient) {
- this.connection = connection;
- this.tokenStore = tokenStore;
- this.oidcClient = oidcClient;
+ super(connection, tokenStore, oidcClient);
}
@Override
@@ -58,21 +53,6 @@ public class YoutubeSearchServlet extends OAuthEnabledSlingServlet {
return request.getRequestURI();
}
- @Override
- protected @NotNull OidcConnection getConnection() {
- return connection;
- }
-
- @Override
- protected @NotNull OidcClient getOidcClient() {
- return oidcClient;
- }
-
- @Override
- protected @NotNull OidcTokenStore getTokenStore() {
- return tokenStore;
- }
-
@Override
protected void doGetWithToken(@NotNull SlingHttpServletRequest request, @NotNull SlingHttpServletResponse response,
OidcToken token) throws IOException, ServletException {
(sling-samples) 03/15: feat: styling using Tailwind CSS
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-samples.git
commit d38672a7febb96e88576f9d713f22a16eb34f30d
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Tue Sep 10 13:44:38 2024 +0200
feat: styling using Tailwind CSS
---
oauth/ui.apps/Makefile | 5 +
.../apps/oauth-demo/components/welcome/output.css | 1 -
.../oauth-demo/components/welcome/welcome.html | 13 +-
.../oauth-demo/components/youtube-videos/show.html | 12 +-
.../content/oauth-demo/static/css/output.css | 634 +++++++++++++++++++++
oauth/ui.apps/src/main/frontend/input.css | 3 +
oauth/ui.apps/tailwind.config.js | 9 +
7 files changed, 666 insertions(+), 11 deletions(-)
diff --git a/oauth/ui.apps/Makefile b/oauth/ui.apps/Makefile
new file mode 100644
index 0000000..8633602
--- /dev/null
+++ b/oauth/ui.apps/Makefile
@@ -0,0 +1,5 @@
+css: src/main/content/jcr_root/content/oauth-demo/static/css/output.css
+.PHONY=css
+
+src/main/content/jcr_root/content/oauth-demo/static/css/output.css: src/main/frontend/input.css
+ tailwindcss --input $< --output $@
diff --git a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/output.css b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/output.css
deleted file mode 100644
index c12b6dd..0000000
--- a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/output.css
+++ /dev/null
@@ -1 +0,0 @@
-/*! tailwindcss v3.4.10 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inheri [...]
\ No newline at end of file
diff --git a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/welcome.html b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/welcome.html
index 7882f74..b9587e7 100644
--- a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/welcome.html
+++ b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/welcome.html
@@ -3,11 +3,12 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link href="./output.css" rel="stylesheet">
+ <link href="/oauth-demo/static/css/output.css" rel="stylesheet">
</head>
-<body>
-<h1 class="text-3xl font-bold underline">OAuth Demo</h1>
-<p>Welcome to the Sling OAuth demo.</p>
-<p>Access the <a href="oauth-demo/videos.html">YouTube videos</a> page.</p>
+<body class="bg-gray-100">
+ <div class="container bg-white rounded mx-auto my-4 p-8">
+ <h1 class="text-3xl mb-4 font-bold">Sling OAuth Demo</h1>
+ <p class="mb-4">Access the <a class="underline" href="oauth-demo/videos.html">YouTube videos</a> page.</p>
+ </div>
</body>
-</html>
+</html>
\ No newline at end of file
diff --git a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
index 3da0ae5..8e808af 100644
--- a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
+++ b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
@@ -3,10 +3,14 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <link href="/oauth-demo/static/css/output.css" rel="stylesheet">
</head>
-<body data-sly-use.youtube="org.apache.sling.samples.oauth_demo.YoutubeVideosModel">
-<h1>Search results</h1>
-<p>ERROR? ${youtube.response.error.message}</p>
-<p>Got ${youtube.response.items.size} results of out total ${youtube.response.pageInfo.totalResults}</p>
+<body class="bg-gray-100"
+ data-sly-use.youtube="org.apache.sling.samples.oauth_demo.YoutubeVideosModel">
+ <div class="container bg-white rounded mx-auto my-4 p-8">
+ <h1 class="text-3xl mb-4 font-bold">Search results</h1>
+ <p class="mb-4">ERROR? ${youtube.response.error.message}</p>
+ <p class="mb-4">Got ${youtube.response.items.size} results of out total ${youtube.response.pageInfo.totalResults}</p>
+ </div>
</body>
</html>
\ No newline at end of file
diff --git a/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/static/css/output.css b/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/static/css/output.css
new file mode 100644
index 0000000..6bd198e
--- /dev/null
+++ b/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/static/css/output.css
@@ -0,0 +1,634 @@
+/*
+! tailwindcss v3.4.10 | MIT License | https://tailwindcss.com
+*/
+
+/*
+1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
+2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
+*/
+
+*,
+::before,
+::after {
+ box-sizing: border-box;
+ /* 1 */
+ border-width: 0;
+ /* 2 */
+ border-style: solid;
+ /* 2 */
+ border-color: #e5e7eb;
+ /* 2 */
+}
+
+::before,
+::after {
+ --tw-content: '';
+}
+
+/*
+1. Use a consistent sensible line-height in all browsers.
+2. Prevent adjustments of font size after orientation changes in iOS.
+3. Use a more readable tab size.
+4. Use the user's configured `sans` font-family by default.
+5. Use the user's configured `sans` font-feature-settings by default.
+6. Use the user's configured `sans` font-variation-settings by default.
+7. Disable tap highlights on iOS
+*/
+
+html,
+:host {
+ line-height: 1.5;
+ /* 1 */
+ -webkit-text-size-adjust: 100%;
+ /* 2 */
+ -moz-tab-size: 4;
+ /* 3 */
+ -o-tab-size: 4;
+ tab-size: 4;
+ /* 3 */
+ font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
+ /* 4 */
+ font-feature-settings: normal;
+ /* 5 */
+ font-variation-settings: normal;
+ /* 6 */
+ -webkit-tap-highlight-color: transparent;
+ /* 7 */
+}
+
+/*
+1. Remove the margin in all browsers.
+2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.
+*/
+
+body {
+ margin: 0;
+ /* 1 */
+ line-height: inherit;
+ /* 2 */
+}
+
+/*
+1. Add the correct height in Firefox.
+2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
+3. Ensure horizontal rules are visible by default.
+*/
+
+hr {
+ height: 0;
+ /* 1 */
+ color: inherit;
+ /* 2 */
+ border-top-width: 1px;
+ /* 3 */
+}
+
+/*
+Add the correct text decoration in Chrome, Edge, and Safari.
+*/
+
+abbr:where([title]) {
+ -webkit-text-decoration: underline dotted;
+ text-decoration: underline dotted;
+}
+
+/*
+Remove the default font size and weight for headings.
+*/
+
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+ font-size: inherit;
+ font-weight: inherit;
+}
+
+/*
+Reset links to optimize for opt-in styling instead of opt-out.
+*/
+
+a {
+ color: inherit;
+ text-decoration: inherit;
+}
+
+/*
+Add the correct font weight in Edge and Safari.
+*/
+
+b,
+strong {
+ font-weight: bolder;
+}
+
+/*
+1. Use the user's configured `mono` font-family by default.
+2. Use the user's configured `mono` font-feature-settings by default.
+3. Use the user's configured `mono` font-variation-settings by default.
+4. Correct the odd `em` font sizing in all browsers.
+*/
+
+code,
+kbd,
+samp,
+pre {
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
+ /* 1 */
+ font-feature-settings: normal;
+ /* 2 */
+ font-variation-settings: normal;
+ /* 3 */
+ font-size: 1em;
+ /* 4 */
+}
+
+/*
+Add the correct font size in all browsers.
+*/
+
+small {
+ font-size: 80%;
+}
+
+/*
+Prevent `sub` and `sup` elements from affecting the line height in all browsers.
+*/
+
+sub,
+sup {
+ font-size: 75%;
+ line-height: 0;
+ position: relative;
+ vertical-align: baseline;
+}
+
+sub {
+ bottom: -0.25em;
+}
+
+sup {
+ top: -0.5em;
+}
+
+/*
+1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
+2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
+3. Remove gaps between table borders by default.
+*/
+
+table {
+ text-indent: 0;
+ /* 1 */
+ border-color: inherit;
+ /* 2 */
+ border-collapse: collapse;
+ /* 3 */
+}
+
+/*
+1. Change the font styles in all browsers.
+2. Remove the margin in Firefox and Safari.
+3. Remove default padding in all browsers.
+*/
+
+button,
+input,
+optgroup,
+select,
+textarea {
+ font-family: inherit;
+ /* 1 */
+ font-feature-settings: inherit;
+ /* 1 */
+ font-variation-settings: inherit;
+ /* 1 */
+ font-size: 100%;
+ /* 1 */
+ font-weight: inherit;
+ /* 1 */
+ line-height: inherit;
+ /* 1 */
+ letter-spacing: inherit;
+ /* 1 */
+ color: inherit;
+ /* 1 */
+ margin: 0;
+ /* 2 */
+ padding: 0;
+ /* 3 */
+}
+
+/*
+Remove the inheritance of text transform in Edge and Firefox.
+*/
+
+button,
+select {
+ text-transform: none;
+}
+
+/*
+1. Correct the inability to style clickable types in iOS and Safari.
+2. Remove default button styles.
+*/
+
+button,
+input:where([type='button']),
+input:where([type='reset']),
+input:where([type='submit']) {
+ -webkit-appearance: button;
+ /* 1 */
+ background-color: transparent;
+ /* 2 */
+ background-image: none;
+ /* 2 */
+}
+
+/*
+Use the modern Firefox focus style for all focusable elements.
+*/
+
+:-moz-focusring {
+ outline: auto;
+}
+
+/*
+Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
+*/
+
+:-moz-ui-invalid {
+ box-shadow: none;
+}
+
+/*
+Add the correct vertical alignment in Chrome and Firefox.
+*/
+
+progress {
+ vertical-align: baseline;
+}
+
+/*
+Correct the cursor style of increment and decrement buttons in Safari.
+*/
+
+::-webkit-inner-spin-button,
+::-webkit-outer-spin-button {
+ height: auto;
+}
+
+/*
+1. Correct the odd appearance in Chrome and Safari.
+2. Correct the outline style in Safari.
+*/
+
+[type='search'] {
+ -webkit-appearance: textfield;
+ /* 1 */
+ outline-offset: -2px;
+ /* 2 */
+}
+
+/*
+Remove the inner padding in Chrome and Safari on macOS.
+*/
+
+::-webkit-search-decoration {
+ -webkit-appearance: none;
+}
+
+/*
+1. Correct the inability to style clickable types in iOS and Safari.
+2. Change font properties to `inherit` in Safari.
+*/
+
+::-webkit-file-upload-button {
+ -webkit-appearance: button;
+ /* 1 */
+ font: inherit;
+ /* 2 */
+}
+
+/*
+Add the correct display in Chrome and Safari.
+*/
+
+summary {
+ display: list-item;
+}
+
+/*
+Removes the default spacing and border for appropriate elements.
+*/
+
+blockquote,
+dl,
+dd,
+h1,
+h2,
+h3,
+h4,
+h5,
+h6,
+hr,
+figure,
+p,
+pre {
+ margin: 0;
+}
+
+fieldset {
+ margin: 0;
+ padding: 0;
+}
+
+legend {
+ padding: 0;
+}
+
+ol,
+ul,
+menu {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+
+/*
+Reset default styling for dialogs.
+*/
+
+dialog {
+ padding: 0;
+}
+
+/*
+Prevent resizing textareas horizontally by default.
+*/
+
+textarea {
+ resize: vertical;
+}
+
+/*
+1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
+2. Set the default placeholder color to the user's configured gray 400 color.
+*/
+
+input::-moz-placeholder, textarea::-moz-placeholder {
+ opacity: 1;
+ /* 1 */
+ color: #9ca3af;
+ /* 2 */
+}
+
+input::placeholder,
+textarea::placeholder {
+ opacity: 1;
+ /* 1 */
+ color: #9ca3af;
+ /* 2 */
+}
+
+/*
+Set the default cursor for buttons.
+*/
+
+button,
+[role="button"] {
+ cursor: pointer;
+}
+
+/*
+Make sure disabled buttons don't get the pointer cursor.
+*/
+
+:disabled {
+ cursor: default;
+}
+
+/*
+1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
+2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
+ This can trigger a poorly considered lint error in some tools but is included by design.
+*/
+
+img,
+svg,
+video,
+canvas,
+audio,
+iframe,
+embed,
+object {
+ display: block;
+ /* 1 */
+ vertical-align: middle;
+ /* 2 */
+}
+
+/*
+Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
+*/
+
+img,
+video {
+ max-width: 100%;
+ height: auto;
+}
+
+/* Make elements with the HTML hidden attribute stay hidden by default */
+
+[hidden] {
+ display: none;
+}
+
+*, ::before, ::after {
+ --tw-border-spacing-x: 0;
+ --tw-border-spacing-y: 0;
+ --tw-translate-x: 0;
+ --tw-translate-y: 0;
+ --tw-rotate: 0;
+ --tw-skew-x: 0;
+ --tw-skew-y: 0;
+ --tw-scale-x: 1;
+ --tw-scale-y: 1;
+ --tw-pan-x: ;
+ --tw-pan-y: ;
+ --tw-pinch-zoom: ;
+ --tw-scroll-snap-strictness: proximity;
+ --tw-gradient-from-position: ;
+ --tw-gradient-via-position: ;
+ --tw-gradient-to-position: ;
+ --tw-ordinal: ;
+ --tw-slashed-zero: ;
+ --tw-numeric-figure: ;
+ --tw-numeric-spacing: ;
+ --tw-numeric-fraction: ;
+ --tw-ring-inset: ;
+ --tw-ring-offset-width: 0px;
+ --tw-ring-offset-color: #fff;
+ --tw-ring-color: rgb(59 130 246 / 0.5);
+ --tw-ring-offset-shadow: 0 0 #0000;
+ --tw-ring-shadow: 0 0 #0000;
+ --tw-shadow: 0 0 #0000;
+ --tw-shadow-colored: 0 0 #0000;
+ --tw-blur: ;
+ --tw-brightness: ;
+ --tw-contrast: ;
+ --tw-grayscale: ;
+ --tw-hue-rotate: ;
+ --tw-invert: ;
+ --tw-saturate: ;
+ --tw-sepia: ;
+ --tw-drop-shadow: ;
+ --tw-backdrop-blur: ;
+ --tw-backdrop-brightness: ;
+ --tw-backdrop-contrast: ;
+ --tw-backdrop-grayscale: ;
+ --tw-backdrop-hue-rotate: ;
+ --tw-backdrop-invert: ;
+ --tw-backdrop-opacity: ;
+ --tw-backdrop-saturate: ;
+ --tw-backdrop-sepia: ;
+ --tw-contain-size: ;
+ --tw-contain-layout: ;
+ --tw-contain-paint: ;
+ --tw-contain-style: ;
+}
+
+::backdrop {
+ --tw-border-spacing-x: 0;
+ --tw-border-spacing-y: 0;
+ --tw-translate-x: 0;
+ --tw-translate-y: 0;
+ --tw-rotate: 0;
+ --tw-skew-x: 0;
+ --tw-skew-y: 0;
+ --tw-scale-x: 1;
+ --tw-scale-y: 1;
+ --tw-pan-x: ;
+ --tw-pan-y: ;
+ --tw-pinch-zoom: ;
+ --tw-scroll-snap-strictness: proximity;
+ --tw-gradient-from-position: ;
+ --tw-gradient-via-position: ;
+ --tw-gradient-to-position: ;
+ --tw-ordinal: ;
+ --tw-slashed-zero: ;
+ --tw-numeric-figure: ;
+ --tw-numeric-spacing: ;
+ --tw-numeric-fraction: ;
+ --tw-ring-inset: ;
+ --tw-ring-offset-width: 0px;
+ --tw-ring-offset-color: #fff;
+ --tw-ring-color: rgb(59 130 246 / 0.5);
+ --tw-ring-offset-shadow: 0 0 #0000;
+ --tw-ring-shadow: 0 0 #0000;
+ --tw-shadow: 0 0 #0000;
+ --tw-shadow-colored: 0 0 #0000;
+ --tw-blur: ;
+ --tw-brightness: ;
+ --tw-contrast: ;
+ --tw-grayscale: ;
+ --tw-hue-rotate: ;
+ --tw-invert: ;
+ --tw-saturate: ;
+ --tw-sepia: ;
+ --tw-drop-shadow: ;
+ --tw-backdrop-blur: ;
+ --tw-backdrop-brightness: ;
+ --tw-backdrop-contrast: ;
+ --tw-backdrop-grayscale: ;
+ --tw-backdrop-hue-rotate: ;
+ --tw-backdrop-invert: ;
+ --tw-backdrop-opacity: ;
+ --tw-backdrop-saturate: ;
+ --tw-backdrop-sepia: ;
+ --tw-contain-size: ;
+ --tw-contain-layout: ;
+ --tw-contain-paint: ;
+ --tw-contain-style: ;
+}
+
+.container {
+ width: 100%;
+}
+
+@media (min-width: 640px) {
+ .container {
+ max-width: 640px;
+ }
+}
+
+@media (min-width: 768px) {
+ .container {
+ max-width: 768px;
+ }
+}
+
+@media (min-width: 1024px) {
+ .container {
+ max-width: 1024px;
+ }
+}
+
+@media (min-width: 1280px) {
+ .container {
+ max-width: 1280px;
+ }
+}
+
+@media (min-width: 1536px) {
+ .container {
+ max-width: 1536px;
+ }
+}
+
+.mx-auto {
+ margin-left: auto;
+ margin-right: auto;
+}
+
+.my-4 {
+ margin-top: 1rem;
+ margin-bottom: 1rem;
+}
+
+.mb-4 {
+ margin-bottom: 1rem;
+}
+
+.rounded {
+ border-radius: 0.25rem;
+}
+
+.bg-gray-100 {
+ --tw-bg-opacity: 1;
+ background-color: rgb(243 244 246 / var(--tw-bg-opacity));
+}
+
+.bg-white {
+ --tw-bg-opacity: 1;
+ background-color: rgb(255 255 255 / var(--tw-bg-opacity));
+}
+
+.p-8 {
+ padding: 2rem;
+}
+
+.text-3xl {
+ font-size: 1.875rem;
+ line-height: 2.25rem;
+}
+
+.font-bold {
+ font-weight: 700;
+}
+
+.underline {
+ text-decoration-line: underline;
+}
diff --git a/oauth/ui.apps/src/main/frontend/input.css b/oauth/ui.apps/src/main/frontend/input.css
new file mode 100644
index 0000000..b5c61c9
--- /dev/null
+++ b/oauth/ui.apps/src/main/frontend/input.css
@@ -0,0 +1,3 @@
+@tailwind base;
+@tailwind components;
+@tailwind utilities;
diff --git a/oauth/ui.apps/tailwind.config.js b/oauth/ui.apps/tailwind.config.js
new file mode 100644
index 0000000..eadfba1
--- /dev/null
+++ b/oauth/ui.apps/tailwind.config.js
@@ -0,0 +1,9 @@
+/** @type {import('tailwindcss').Config} */
+module.exports = {
+ content: ["./src/main/content/jcr_root/**/*.{html,js}"],
+ theme: {
+ extend: {},
+ },
+ plugins: [],
+}
+
(sling-samples) 10/15: feat: extend styling of the videos page
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-samples.git
commit 8147f41827d5558d5e07e2647be084ddb6b62d71
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Tue Sep 10 18:16:13 2024 +0200
feat: extend styling of the videos page
- form styling
- button
- card-like layout
---
.../oauth-demo/components/youtube-videos/show.html | 30 +--
.../content/oauth-demo/static/css/output.css | 251 +++++++++++++++++++++
oauth/ui.apps/tailwind.config.js | 4 +-
3 files changed, 271 insertions(+), 14 deletions(-)
diff --git a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
index 622348b..22fced8 100644
--- a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
+++ b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
@@ -7,26 +7,30 @@
</head>
<body data-sly-use.youtube="org.apache.sling.samples.oauth_demo.YoutubeVideosModel">
<main>
- <h1>Youtube Videos</h1>
- <form>
- <label for="search">Search:</label>
- <input type="text" id="search" name="search" value="${youtube.search}">
- <button type="submit">Search</button>
- </form>
+ <header class="flex flex-row justify-between">
+ <h1>Youtube Videos</h1>
+ <form>
+ <input type="text" id="search" name="search" value="${youtube.search}">
+ <button type="submit" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">Search</button>
+ </form>
+ </header>
<p data-sly-test="${youtube.response.error}">Error code ${youtube.response.error.code} : ${youtube.response.error.message}</p>
<sly data-sly-test="${youtube.response.items}">
<div data-sly-list.item="${youtube.response.items}"
class="flex flex-row flex-wrap">
- <div class="basis-1/3 px-4">
- <a href="https://www.youtube.com/watch?v=${item.id.videoId}" target="_blank">
- <h2>${item.snippet.title}</h2>
- <img src="${item.snippet.thumbnails.medium.url}" alt="${item.snippet.title}">
- <p>${item.snippet.description}</p>
- </a>
- </div>
+ <div class="basis-1/3">
+ <div class="px-4 bg-white rounded overflow-hidden shadow-lg m-2">
+ <a href="https://www.youtube.com/watch?v=${item.id.videoId}" target="_blank">
+ <h2>${item.snippet.title}</h2>
+ <img src="${item.snippet.thumbnails.medium.url}" alt="${item.snippet.title}">
+ <p>${item.snippet.description}</p>
+ </a>
+ </div>
+ </div>
</div>
<p>Got ${youtube.response.items.size} results of out total ${youtube.response.pageInfo.totalResults}</p>
</sly>
+ <p>Back to the <a class="underline" href="../oauth-demo.html">main page</a>.</p>
</main>
</body>
</html>
\ No newline at end of file
diff --git a/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/static/css/output.css b/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/static/css/output.css
index 3de0017..e65455f 100644
--- a/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/static/css/output.css
+++ b/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/static/css/output.css
@@ -446,6 +446,201 @@ video {
display: none;
}
+[type='text'],input:where(:not([type])),[type='email'],[type='url'],[type='password'],[type='number'],[type='date'],[type='datetime-local'],[type='month'],[type='search'],[type='tel'],[type='time'],[type='week'],[multiple],textarea,select {
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ appearance: none;
+ background-color: #fff;
+ border-color: #6b7280;
+ border-width: 1px;
+ border-radius: 0px;
+ padding-top: 0.5rem;
+ padding-right: 0.75rem;
+ padding-bottom: 0.5rem;
+ padding-left: 0.75rem;
+ font-size: 1rem;
+ line-height: 1.5rem;
+ --tw-shadow: 0 0 #0000;
+}
+
+[type='text']:focus, input:where(:not([type])):focus, [type='email']:focus, [type='url']:focus, [type='password']:focus, [type='number']:focus, [type='date']:focus, [type='datetime-local']:focus, [type='month']:focus, [type='search']:focus, [type='tel']:focus, [type='time']:focus, [type='week']:focus, [multiple]:focus, textarea:focus, select:focus {
+ outline: 2px solid transparent;
+ outline-offset: 2px;
+ --tw-ring-inset: var(--tw-empty,/*!*/ /*!*/);
+ --tw-ring-offset-width: 0px;
+ --tw-ring-offset-color: #fff;
+ --tw-ring-color: #2563eb;
+ --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
+ --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
+ box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
+ border-color: #2563eb;
+}
+
+input::-moz-placeholder, textarea::-moz-placeholder {
+ color: #6b7280;
+ opacity: 1;
+}
+
+input::placeholder,textarea::placeholder {
+ color: #6b7280;
+ opacity: 1;
+}
+
+::-webkit-datetime-edit-fields-wrapper {
+ padding: 0;
+}
+
+::-webkit-date-and-time-value {
+ min-height: 1.5em;
+ text-align: inherit;
+}
+
+::-webkit-datetime-edit {
+ display: inline-flex;
+}
+
+::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field {
+ padding-top: 0;
+ padding-bottom: 0;
+}
+
+select {
+ background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
+ background-position: right 0.5rem center;
+ background-repeat: no-repeat;
+ background-size: 1.5em 1.5em;
+ padding-right: 2.5rem;
+ -webkit-print-color-adjust: exact;
+ print-color-adjust: exact;
+}
+
+[multiple],[size]:where(select:not([size="1"])) {
+ background-image: initial;
+ background-position: initial;
+ background-repeat: unset;
+ background-size: initial;
+ padding-right: 0.75rem;
+ -webkit-print-color-adjust: unset;
+ print-color-adjust: unset;
+}
+
+[type='checkbox'],[type='radio'] {
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ appearance: none;
+ padding: 0;
+ -webkit-print-color-adjust: exact;
+ print-color-adjust: exact;
+ display: inline-block;
+ vertical-align: middle;
+ background-origin: border-box;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ user-select: none;
+ flex-shrink: 0;
+ height: 1rem;
+ width: 1rem;
+ color: #2563eb;
+ background-color: #fff;
+ border-color: #6b7280;
+ border-width: 1px;
+ --tw-shadow: 0 0 #0000;
+}
+
+[type='checkbox'] {
+ border-radius: 0px;
+}
+
+[type='radio'] {
+ border-radius: 100%;
+}
+
+[type='checkbox']:focus,[type='radio']:focus {
+ outline: 2px solid transparent;
+ outline-offset: 2px;
+ --tw-ring-inset: var(--tw-empty,/*!*/ /*!*/);
+ --tw-ring-offset-width: 2px;
+ --tw-ring-offset-color: #fff;
+ --tw-ring-color: #2563eb;
+ --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
+ --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
+ box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
+}
+
+[type='checkbox']:checked,[type='radio']:checked {
+ border-color: transparent;
+ background-color: currentColor;
+ background-size: 100% 100%;
+ background-position: center;
+ background-repeat: no-repeat;
+}
+
+[type='checkbox']:checked {
+ background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
+}
+
+@media (forced-colors: active) {
+ [type='checkbox']:checked {
+ -webkit-appearance: auto;
+ -moz-appearance: auto;
+ appearance: auto;
+ }
+}
+
+[type='radio']:checked {
+ background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e");
+}
+
+@media (forced-colors: active) {
+ [type='radio']:checked {
+ -webkit-appearance: auto;
+ -moz-appearance: auto;
+ appearance: auto;
+ }
+}
+
+[type='checkbox']:checked:hover,[type='checkbox']:checked:focus,[type='radio']:checked:hover,[type='radio']:checked:focus {
+ border-color: transparent;
+ background-color: currentColor;
+}
+
+[type='checkbox']:indeterminate {
+ background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3e%3cpath stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3e%3c/svg%3e");
+ border-color: transparent;
+ background-color: currentColor;
+ background-size: 100% 100%;
+ background-position: center;
+ background-repeat: no-repeat;
+}
+
+@media (forced-colors: active) {
+ [type='checkbox']:indeterminate {
+ -webkit-appearance: auto;
+ -moz-appearance: auto;
+ appearance: auto;
+ }
+}
+
+[type='checkbox']:indeterminate:hover,[type='checkbox']:indeterminate:focus {
+ border-color: transparent;
+ background-color: currentColor;
+}
+
+[type='file'] {
+ background: unset;
+ border-color: inherit;
+ border-width: 0;
+ border-radius: 0;
+ padding: 0;
+ font-size: unset;
+ line-height: inherit;
+}
+
+[type='file']:focus {
+ outline: 1px solid ButtonText;
+ outline: 1px auto -webkit-focus-ring-color;
+}
+
body {
--tw-bg-opacity: 1;
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
@@ -622,6 +817,10 @@ p {
--tw-contain-style: ;
}
+.m-2 {
+ margin: 0.5rem;
+}
+
.flex {
display: flex;
}
@@ -638,11 +837,63 @@ p {
flex-wrap: wrap;
}
+.justify-between {
+ justify-content: space-between;
+}
+
+.overflow-hidden {
+ overflow: hidden;
+}
+
+.rounded {
+ border-radius: 0.25rem;
+}
+
+.bg-blue-500 {
+ --tw-bg-opacity: 1;
+ background-color: rgb(59 130 246 / var(--tw-bg-opacity));
+}
+
+.bg-white {
+ --tw-bg-opacity: 1;
+ background-color: rgb(255 255 255 / var(--tw-bg-opacity));
+}
+
+.px-2 {
+ padding-left: 0.5rem;
+ padding-right: 0.5rem;
+}
+
.px-4 {
padding-left: 1rem;
padding-right: 1rem;
}
+.py-2 {
+ padding-top: 0.5rem;
+ padding-bottom: 0.5rem;
+}
+
+.font-bold {
+ font-weight: 700;
+}
+
+.text-white {
+ --tw-text-opacity: 1;
+ color: rgb(255 255 255 / var(--tw-text-opacity));
+}
+
.underline {
text-decoration-line: underline;
+}
+
+.shadow-lg {
+ --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
+ --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);
+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
+}
+
+.hover\:bg-blue-700:hover {
+ --tw-bg-opacity: 1;
+ background-color: rgb(29 78 216 / var(--tw-bg-opacity));
}
\ No newline at end of file
diff --git a/oauth/ui.apps/tailwind.config.js b/oauth/ui.apps/tailwind.config.js
index eadfba1..04b230e 100644
--- a/oauth/ui.apps/tailwind.config.js
+++ b/oauth/ui.apps/tailwind.config.js
@@ -4,6 +4,8 @@ module.exports = {
theme: {
extend: {},
},
- plugins: [],
+ plugins: [
+ require('@tailwindcss/forms'),
+ ],
}
(sling-samples) 15/15: chore(oauth): configure the JcrUserHomeOAuthTokenStore
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-samples.git
commit 6c69c799cf095cd05200ce5930b4102469dcd0a5
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Thu Sep 19 18:09:39 2024 +0200
chore(oauth): configure the JcrUserHomeOAuthTokenStore
---
oauth/launcher/src/main/features/launcher.json | 2 ++
1 file changed, 2 insertions(+)
diff --git a/oauth/launcher/src/main/features/launcher.json b/oauth/launcher/src/main/features/launcher.json
index 20e2c90..6fd3196 100644
--- a/oauth/launcher/src/main/features/launcher.json
+++ b/oauth/launcher/src/main/features/launcher.json
@@ -21,6 +21,8 @@
"clientId": "$[secret:google/clientId]",
"clientSecret": "$[secret:google/clientSecret]",
"scopes": ["openid", "https://www.googleapis.com/auth/youtube.force-ssl"]
+ },
+ "org.apache.sling.extensions.oauth_client.impl.JcrUserHomeOAuthTokenStore" : {
}
}
}
(sling-samples) 06/15: feat: simplify HTML/CSS with @apply
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-samples.git
commit e643368b04738bc7283acd4a76474d61c251f182
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Tue Sep 10 17:02:01 2024 +0200
feat: simplify HTML/CSS with @apply
---
.../oauth-demo/components/welcome/welcome.html | 10 +-
.../oauth-demo/components/youtube-videos/show.html | 17 ++-
.../content/oauth-demo/static/css/output.css | 150 ++++++++++-----------
oauth/ui.apps/src/main/frontend/input.css | 23 ++++
4 files changed, 105 insertions(+), 95 deletions(-)
diff --git a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/welcome.html b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/welcome.html
index b9587e7..d424700 100644
--- a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/welcome.html
+++ b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/welcome.html
@@ -5,10 +5,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/oauth-demo/static/css/output.css" rel="stylesheet">
</head>
-<body class="bg-gray-100">
- <div class="container bg-white rounded mx-auto my-4 p-8">
- <h1 class="text-3xl mb-4 font-bold">Sling OAuth Demo</h1>
- <p class="mb-4">Access the <a class="underline" href="oauth-demo/videos.html">YouTube videos</a> page.</p>
- </div>
+<body>
+ <main>
+ <h1>Sling OAuth Demo</h1>
+ <p>Access the <a class="underline" href="oauth-demo/videos.html">YouTube videos</a> page.</p>
+ </main>
</body>
</html>
\ No newline at end of file
diff --git a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
index 44bebf5..57c4cf1 100644
--- a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
+++ b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
@@ -5,22 +5,21 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/oauth-demo/static/css/output.css" rel="stylesheet">
</head>
-<body class="bg-gray-100"
- data-sly-use.youtube="org.apache.sling.samples.oauth_demo.YoutubeVideosModel">
- <div class="container bg-white rounded mx-auto my-4 p-8">
- <h1 class="text-3xl mb-4 font-bold">Search results</h1>
- <p class="mb-4">ERROR? ${youtube.response.error.message}</p>
- <p class="mb-4">Got ${youtube.response.items.size} results of out total ${youtube.response.pageInfo.totalResults}</p>
+<body data-sly-use.youtube="org.apache.sling.samples.oauth_demo.YoutubeVideosModel">
+ <main>
+ <h1>Search results</h1>
+ <p>ERROR? ${youtube.response.error.message}</p>
+ <p>Got ${youtube.response.items.size} results of out total ${youtube.response.pageInfo.totalResults}</p>
<div data-sly-list.item="${youtube.response.items}"
class="flex flex-row flex-wrap">
<div class="basis-1/3 px-4">
<a href="https://www.youtube.com/watch?v=${item.id.videoId}" target="_blank">
- <h2 class="mb-4 text-xl font-bold">${item.snippet.title}</h2>
+ <h2>${item.snippet.title}</h2>
<img src="${item.snippet.thumbnails.medium.url}" alt="${item.snippet.title}">
- <p class="mb-4">${item.snippet.description}</p>
+ <p>${item.snippet.description}</p>
</a>
</div>
</div>
- </div>
+ </main>
</body>
</html>
\ No newline at end of file
diff --git a/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/static/css/output.css b/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/static/css/output.css
index db15688..3de0017 100644
--- a/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/static/css/output.css
+++ b/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/static/css/output.css
@@ -446,6 +446,74 @@ video {
display: none;
}
+body {
+ --tw-bg-opacity: 1;
+ background-color: rgb(243 244 246 / var(--tw-bg-opacity));
+}
+
+main {
+ width: 100%;
+}
+
+@media (min-width: 640px) {
+ main {
+ max-width: 640px;
+ }
+}
+
+@media (min-width: 768px) {
+ main {
+ max-width: 768px;
+ }
+}
+
+@media (min-width: 1024px) {
+ main {
+ max-width: 1024px;
+ }
+}
+
+@media (min-width: 1280px) {
+ main {
+ max-width: 1280px;
+ }
+}
+
+@media (min-width: 1536px) {
+ main {
+ max-width: 1536px;
+ }
+}
+
+main {
+ margin-left: auto;
+ margin-right: auto;
+ margin-top: 1rem;
+ margin-bottom: 1rem;
+ border-radius: 0.25rem;
+ --tw-bg-opacity: 1;
+ background-color: rgb(255 255 255 / var(--tw-bg-opacity));
+ padding: 2rem;
+}
+
+h1 {
+ margin-bottom: 1rem;
+ font-size: 1.875rem;
+ line-height: 2.25rem;
+ font-weight: 700;
+}
+
+h2 {
+ margin-bottom: 1rem;
+ font-size: 1.25rem;
+ line-height: 1.75rem;
+ font-weight: 700;
+}
+
+p {
+ margin-bottom: 1rem;
+}
+
*, ::before, ::after {
--tw-border-spacing-x: 0;
--tw-border-spacing-y: 0;
@@ -554,54 +622,6 @@ video {
--tw-contain-style: ;
}
-.container {
- width: 100%;
-}
-
-@media (min-width: 640px) {
- .container {
- max-width: 640px;
- }
-}
-
-@media (min-width: 768px) {
- .container {
- max-width: 768px;
- }
-}
-
-@media (min-width: 1024px) {
- .container {
- max-width: 1024px;
- }
-}
-
-@media (min-width: 1280px) {
- .container {
- max-width: 1280px;
- }
-}
-
-@media (min-width: 1536px) {
- .container {
- max-width: 1536px;
- }
-}
-
-.mx-auto {
- margin-left: auto;
- margin-right: auto;
-}
-
-.my-4 {
- margin-top: 1rem;
- margin-bottom: 1rem;
-}
-
-.mb-4 {
- margin-bottom: 1rem;
-}
-
.flex {
display: flex;
}
@@ -618,43 +638,11 @@ video {
flex-wrap: wrap;
}
-.rounded {
- border-radius: 0.25rem;
-}
-
-.bg-gray-100 {
- --tw-bg-opacity: 1;
- background-color: rgb(243 244 246 / var(--tw-bg-opacity));
-}
-
-.bg-white {
- --tw-bg-opacity: 1;
- background-color: rgb(255 255 255 / var(--tw-bg-opacity));
-}
-
-.p-8 {
- padding: 2rem;
-}
-
.px-4 {
padding-left: 1rem;
padding-right: 1rem;
}
-.text-3xl {
- font-size: 1.875rem;
- line-height: 2.25rem;
-}
-
-.text-xl {
- font-size: 1.25rem;
- line-height: 1.75rem;
-}
-
-.font-bold {
- font-weight: 700;
-}
-
.underline {
text-decoration-line: underline;
-}
+}
\ No newline at end of file
diff --git a/oauth/ui.apps/src/main/frontend/input.css b/oauth/ui.apps/src/main/frontend/input.css
index b5c61c9..70a6a85 100644
--- a/oauth/ui.apps/src/main/frontend/input.css
+++ b/oauth/ui.apps/src/main/frontend/input.css
@@ -1,3 +1,26 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
+
+@layer base {
+
+ body {
+ @apply bg-gray-100;
+ }
+
+ main {
+ @apply container bg-white rounded mx-auto my-4 p-8
+ }
+
+ h1 {
+ @apply text-3xl mb-4 font-bold;
+ }
+
+ h2 {
+ @apply text-xl mb-4 font-bold;
+ }
+
+ p {
+ @apply mb-4;
+ }
+}
\ No newline at end of file
(sling-samples) 12/15: feat(oauth): configure secrets
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-samples.git
commit c32b4092ba7ba7ddf91fcf519a88320f4a774d01
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Thu Sep 19 14:58:50 2024 +0200
feat(oauth): configure secrets
---
oauth/.gitignore | 1 +
oauth/launcher/Makefile | 39 ++++++++++++++++++++++++++
oauth/launcher/launch.sh | 24 ----------------
oauth/launcher/src/main/features/launcher.json | 11 +++++++-
4 files changed, 50 insertions(+), 25 deletions(-)
diff --git a/oauth/.gitignore b/oauth/.gitignore
index c4459ec..713a707 100644
--- a/oauth/.gitignore
+++ b/oauth/.gitignore
@@ -1 +1,2 @@
launcher/launcher/
+launcher/secrets/
diff --git a/oauth/launcher/Makefile b/oauth/launcher/Makefile
new file mode 100644
index 0000000..dc1e5d2
--- /dev/null
+++ b/oauth/launcher/Makefile
@@ -0,0 +1,39 @@
+# 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.
+
+secrets/google/clientId:
+ @echo [WARN] $@ missing, OIDC config needs to be created manually
+
+secrets/google/clientSecret:
+ @echo [WARN] $@ missing, OIDC config needs to be created manually
+
+run: target/dependency/org.apache.sling.feature.launcher/bin/launcher secrets/google/clientId secrets/google/clientSecret
+ @echo '-------------------------------------------------------------------------------------------'
+ @echo '[NOTE] Launching application, this will fail if you did not build the project at least once'
+ @echo '[NOTE] Remove the launcher folder to throw away local changes'
+ @echo '-------------------------------------------------------------------------------------------'
+ $< -f target/slingfeature-tmp/feature-app.json -D org.apache.felix.configadmin.plugin.interpolation.secretsdir=secrets
+.PHONY=run
+
+target/dependency/org.apache.sling.feature.launcher/bin/launcher:
+ mvn package
+
+run-redis:
+ docker run -d --name sling-oauth-redis -p 6379:6379 redis:7.4
+.PHONY=run-redis
+
+clean:
+ rm -rf launcher
+.PHONY=clean
diff --git a/oauth/launcher/launch.sh b/oauth/launcher/launch.sh
deleted file mode 100755
index 36884d1..0000000
--- a/oauth/launcher/launch.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh -eu
-#
-# 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.
-#
-
-echo '-------------------------------------------------------------------------------------------'
-echo '[NOTE] Launching application, this will fail if you did not build the project at least once'
-echo '[NOTE] Remove the launcher folder to throw away local changes'
-echo '-------------------------------------------------------------------------------------------'
-
-target/dependency/org.apache.sling.feature.launcher/bin/launcher -f target/slingfeature-tmp/feature-app.json
diff --git a/oauth/launcher/src/main/features/launcher.json b/oauth/launcher/src/main/features/launcher.json
index 0334e9a..76ff1e3 100644
--- a/oauth/launcher/src/main/features/launcher.json
+++ b/oauth/launcher/src/main/features/launcher.json
@@ -13,5 +13,14 @@
{
"id":"org.apache.sling.samples/org.apache.sling.samples.oauth.ui.apps/1.0-SNAPSHOT/zip"
}
- ]
+ ],
+ "configurations": {
+ "org.apache.sling.extensions.oauth_client.impl.OidcConnectionImpl~google": {
+ "name": "google",
+ "baseUrl": "https://accounts.google.com",
+ "clientId": "$[secret:google/clientId]",
+ "clientSecret": "$[secret:google/clientSecret]",
+ "scopes": ["openid", "https://www.googleapis.com/auth/youtube.force-ssl"]
+ }
+ }
}
(sling-samples) 13/15: chore(oauth): adapt to upstream changes
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-samples.git
commit 33e568813ef8fa47f5c52660c1a55a9780a492bd
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Thu Sep 19 14:59:44 2024 +0200
chore(oauth): adapt to upstream changes
---
oauth/core/pom.xml | 2 +-
.../samples/oauth_demo/impl/YoutubeSearchServlet.java | 14 +++++++-------
oauth/launcher/pom.xml | 2 +-
oauth/launcher/src/main/features/launcher.json | 2 +-
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/oauth/core/pom.xml b/oauth/core/pom.xml
index 1feabe1..7b8a30f 100644
--- a/oauth/core/pom.xml
+++ b/oauth/core/pom.xml
@@ -150,7 +150,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.extensions.oidc-rp</artifactId>
+ <artifactId>org.apache.sling.extensions.oauth-client</artifactId>
<version>0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
diff --git a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeSearchServlet.java b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeSearchServlet.java
index da3ff43..363e251 100644
--- a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeSearchServlet.java
+++ b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeSearchServlet.java
@@ -25,11 +25,11 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.request.RequestDispatcherOptions;
-import org.apache.sling.extensions.oidc_rp.OidcClient;
-import org.apache.sling.extensions.oidc_rp.OidcConnection;
-import org.apache.sling.extensions.oidc_rp.OidcToken;
-import org.apache.sling.extensions.oidc_rp.OidcTokenStore;
-import org.apache.sling.extensions.oidc_rp.support.OAuthEnabledSlingServlet;
+import org.apache.sling.extensions.oauth_client.OAuthToken;
+import org.apache.sling.extensions.oauth_client.OAuthTokenRefresher;
+import org.apache.sling.extensions.oauth_client.OAuthTokenStore;
+import org.apache.sling.extensions.oauth_client.OidcConnection;
+import org.apache.sling.extensions.oauth_client.support.OAuthEnabledSlingServlet;
import org.apache.sling.samples.oauth_demo.YoutubeSearchResponse;
import org.apache.sling.servlets.annotations.SlingServletResourceTypes;
import org.jetbrains.annotations.NotNull;
@@ -44,7 +44,7 @@ public class YoutubeSearchServlet extends OAuthEnabledSlingServlet {
private static final long serialVersionUID = 1L;
@Activate
- public YoutubeSearchServlet(@Reference OidcConnection connection, @Reference OidcTokenStore tokenStore, @Reference OidcClient oidcClient) {
+ public YoutubeSearchServlet(@Reference OidcConnection connection, @Reference OAuthTokenStore tokenStore, @Reference OAuthTokenRefresher oidcClient) {
super(connection, tokenStore, oidcClient);
}
@@ -55,7 +55,7 @@ public class YoutubeSearchServlet extends OAuthEnabledSlingServlet {
@Override
protected void doGetWithToken(@NotNull SlingHttpServletRequest request, @NotNull SlingHttpServletResponse response,
- OidcToken token) throws IOException, ServletException {
+ OAuthToken token) throws IOException, ServletException {
try {
String search = request.getParameter("search");
diff --git a/oauth/launcher/pom.xml b/oauth/launcher/pom.xml
index 7758ca2..28d8e68 100644
--- a/oauth/launcher/pom.xml
+++ b/oauth/launcher/pom.xml
@@ -59,7 +59,7 @@
<filesInclude>*.json</filesInclude>
<includeArtifact>
<groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.extensions.oidc-rp</artifactId>
+ <artifactId>org.apache.sling.extensions.oauth-client</artifactId>
<classifier>app</classifier>
<version>0.1-SNAPSHOT</version>
<type>slingosgifeature</type>
diff --git a/oauth/launcher/src/main/features/launcher.json b/oauth/launcher/src/main/features/launcher.json
index 76ff1e3..20e2c90 100644
--- a/oauth/launcher/src/main/features/launcher.json
+++ b/oauth/launcher/src/main/features/launcher.json
@@ -5,7 +5,7 @@
"start-order": 25
},
{
- "id": "org.apache.sling/org.apache.sling.extensions.oidc-rp/0.1-SNAPSHOT",
+ "id": "org.apache.sling/org.apache.sling.extensions.oauth-client/0.1-SNAPSHOT",
"start-order": 24
}
],
(sling-samples) 04/15: chore: remove outdated comment
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-samples.git
commit 58b61d9c38724622fd657899e1478c8632126cfd
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Tue Sep 10 13:45:09 2024 +0200
chore: remove outdated comment
---
.../org/apache/sling/samples/oauth_demo/impl/YoutubeSearchServlet.java | 2 --
1 file changed, 2 deletions(-)
diff --git a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeSearchServlet.java b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeSearchServlet.java
index 5aa6d2d..cec6692 100644
--- a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeSearchServlet.java
+++ b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeSearchServlet.java
@@ -88,8 +88,6 @@ public class YoutubeSearchServlet extends OAuthEnabledSlingServlet {
response.setContentType("text/html");
request.getRequestDispatcher(request.getResource(), opts).include(request, response);
- // TODO - needs a thin use object shim to expose the request attribute or a generic BVP
-
// response.setStatus(HttpServletResponse.SC_OK);
// response.setContentType("text/html");
// response.getWriter().write(String.format("<p>Got %s results out of total %s</p>", youtubeResponse.items().size(), youtubeResponse.pageInfo().totalResults()));
(sling-samples) 01/15: oauth: import after archetype generation
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-samples.git
commit 50f8ae21db3536f3c8e931508564e919bf1692e8
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Fri Aug 23 17:59:38 2024 +0200
oauth: import after archetype generation
---
oauth/.gitignore | 1 +
oauth/README.md | 133 +
oauth/all/pom.xml | 105 +
oauth/core/pom.xml | 150 ++
oauth/launcher/launch.sh | 24 +
oauth/launcher/pom.xml | 118 +
oauth/launcher/src/main/features/launcher.json | 13 +
oauth/pom.xml | 2740 ++++++++++++++++++++
oauth/ui.apps/pom.xml | 65 +
.../src/main/content/META-INF/vault/filter.xml | 39 +
.../src/main/content/META-INF/vault/settings.xml | 17 +
.../content/jcr_root/apps/oauth-demo/.content.xml | 24 +
.../jcr_root/apps/oauth-demo/install/.content.xml | 23 +
.../jcr_root/content/oauth-demo/.content.xml | 24 +
14 files changed, 3476 insertions(+)
diff --git a/oauth/.gitignore b/oauth/.gitignore
new file mode 100644
index 0000000..c4459ec
--- /dev/null
+++ b/oauth/.gitignore
@@ -0,0 +1 @@
+launcher/launcher/
diff --git a/oauth/README.md b/oauth/README.md
new file mode 100644
index 0000000..e20dcbf
--- /dev/null
+++ b/oauth/README.md
@@ -0,0 +1,133 @@
+### Maven Project generated from Maven Archetype
+
+#### License
+
+ 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.
+
+#### Introduction
+
+This project was created by the Full Project Sling Maven Archetype which created
+four modules:
+
+1. **core**: OSGi Bundle which is deployed as OSGi Bundle to Sling which includes your
+ Servlets, Filters, Sling Models and much more. This module is **not intended**
+ to contain Sling Content.
+2. **ui.apps**: JCR Content Module which is used to install a JCR Package into Sling
+ by using **Composum**. For that it must be installed and the Composum
+ Package Manager must be whitelisted.
+3. **launcher**: Feature model module which assembles a full application from the project
+ which can then be launched using the included `./launch.sh` script
+4. **all**: This is another JCR Content Module but it is only used to install the
+ other two modules.
+
+There are also two more modules that provide some examples with the same name plus
+the **.example** extension. This modules should not be deployed as is but rather
+examples that you want to use should be copied to the core or ui.apps module.
+The structure of both modules are the same and so copying them over just be
+quite simple.
+
+#### Why the All Package
+
+Most real projects have many different OSGi bundles, Content Packages, Configuration
+Modules and many more. Deploying them one by one is cumbersome and can lead to
+inconsitency and to a lot of overhead in a Continious Integration system.
+The **All** package allows you to deploy all theses artifacts in one swoop or it allows
+you to deploy them to multiple targets by just repeating the **All** deployment.
+
+##### Adding a new Module
+
+If you create a new Maven module then you need to add them to the **All** POM as
+well to include them into the All deployment. These are the steps:
+
+1. Add the dependency to the new module in the All POM
+2. Add the module to the **maven-vault-plugin** definition
+ 1. If this is a content package then into the **subPackages**
+ 2. If this is an OSGi Bundle then into the **embeddeds**
+
+##### Package Filter
+
+In any multi-content-package environment the developer needs to pay close attention
+to the **content filtering** in the **META-INF/vault/filter.xml** as this can lead
+to hard to detect issues. Please make sure that:
+
+1. Exclude **/apps/<apps-folder-name>/install** from any of your content package
+ as in that folder the **All** package is installing the bundles into
+2. Make sure that content packages are not removing each other contents. The rule is
+ that each content package has their own sub folder inside **/apps/<apps-folder-name>**
+ and avoid overlap.
+3. Any shared folders like **overlays** need to be separated from each other.
+ It is a good idea to limit your filter to smallest subset possible to avoid
+ future issues if another package needs to place their overlays into the
+ same folder.
+
+The package filter is a **mask** that tells Sling which part of the JCR tree
+your package maintains and after the deployment that part of the JCR tree will
+be the same as in your package. All missing ndoes in Sling will be created, all
+existing nodes will be updated and all missing nodes in your package will be
+deleted in Sling.
+
+
+#### Why a JCR Package instead of a Content Bundle
+
+There a several reasons to use a JCR Package instead of a Content Bundle
+but for the most important reason is that a JCR Package allows the **Sling
+Tooling** to update a single file rather than an entire Bundle and also
+to import a Node from Sling into the project.
+
+
+#### Attention:
+
+Due to the way Apache Maven Archetypes work both **example** modules are added
+to the parent POM's module list. Please **remove** them after you created them
+to avoid the installation of these modules into Sling.
+At the end of the parent POM you will find the lines below. Remove the lines
+with **core.example** and **ui.apps.example**.
+
+ <modules>
+ <module>core</module>
+ <module>core.example</module>
+ <module>ui.apps</module>
+ <module>ui.apps.example</module>
+ <module>launcher</module>
+ <module>all</module>
+ </modules>
+
+#### Build and Installation
+
+The project is built quite simple:
+
+ mvn clean install
+
+To install the project **autoInstallAll**:
+
+ mvn clean install -P autoInstallAll
+
+##### ATTENTION
+
+It is not a good idea to deploy code with both approaches.
+Choose one and stick with it as you can either loose a bundle
+or the bundle is not updated during installation.
+
+In case of a mishape the package and bundles needs to deinstalled
+manullay:
+
+1. Remove /apps/${appsFolderName}/install folder
+2. Uninstall the package using the package manager
+3. Remove the package from /etc/packages including the snapshots if they are still there
+4. Remove the Bundle using the OSGi Console (/system/console/bundles)
+
diff --git a/oauth/all/pom.xml b/oauth/all/pom.xml
new file mode 100644
index 0000000..ecae3af
--- /dev/null
+++ b/oauth/all/pom.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<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/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.apache.sling.samples.oauth</artifactId>
+ <groupId>org.apache.sling.samples</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.apache.sling.samples.oauth.all</artifactId>
+ <packaging>content-package</packaging>
+
+ <name>Sling OAuth Demo - All</name>
+ <description>org.apache.sling.samples.oauth - Sling OAuth Demo: All-in-one deployment content package</description>
+
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>org.apache.sling.samples.oauth.core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>org.apache.sling.samples.oauth.ui.apps</artifactId>
+ <version>${project.version}</version>
+ <type>content-package</type>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>filevault-package-maven-plugin</artifactId>
+ <configuration>
+ <packageType>container</packageType>
+ <embeddedTarget>/apps/oauth-demo/install</embeddedTarget>
+ <embeddeds>
+ <embedded>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>org.apache.sling.samples.oauth.core</artifactId>
+ <filter>true</filter>
+ </embedded>
+ </embeddeds>
+ <subPackages>
+ <subPackage>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>org.apache.sling.samples.oauth.ui.apps</artifactId>
+ <filter>true</filter>
+ </subPackage>
+ </subPackages>
+ <!-- This gives the Package a recognizable name in the Package Manager by prepending the Artifact Id of the Project -->
+ <name>org.apache.sling.samples.oauth-all</name>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>autoInstallAll</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.wcm.maven.plugins</groupId>
+ <artifactId>wcmio-content-package-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>install-package</id>
+ <goals>
+ <goal>install</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git a/oauth/core/pom.xml b/oauth/core/pom.xml
new file mode 100644
index 0000000..d7dc281
--- /dev/null
+++ b/oauth/core/pom.xml
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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.
+-->
+<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/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.apache.sling.samples.oauth</artifactId>
+ <groupId>org.apache.sling.samples</groupId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.apache.sling.samples.oauth.core</artifactId>
+ <packaging>bundle</packaging>
+
+ <name>Sling OAuth Demo - Core</name>
+ <description>
+ This is an empty OSGi Bundle which can be used
+ to compile and deploy OSGi Services to Sling.
+
+ This Bundle can be deployed using the Profile
+ "autoInstallBundle" but that should not be used
+ together with the "ui.apps" Profile "autoInstallAll"
+ as they are not deployed the same way and can lead
+ to undesired issues during deployment (bundle not
+ updated or not working at all).
+ </description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Embed-Dependency>*;scope=compile;inline=true</Embed-Dependency>
+ <Sling-Model-Packages>org.apache.sling.samples.oauth.model</Sling-Model-Packages>
+ <_dsannotations>*</_dsannotations>
+ <_metatypeannotations>*</_metatypeannotations>
+ <_removeheaders>
+ Embed-Dependency,
+ Private-Package,
+ Include-Resource
+ </_removeheaders>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>11</source>
+ <target>11</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>maven-sling-plugin</artifactId>
+ <configuration>
+ <slingUrl>http://${sling.host}:${sling.port}/system/console</slingUrl>
+ <user>${sling.user}</user>
+ <password>${sling.password}</password>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.annotation</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.service.component.annotations</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.service.metatype.annotations</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.jcr</groupId>
+ <artifactId>jcr</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.models.api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+ <!--
+ Attention: the autoInstallBundle was removed as deploying bundles directly and through a package is causing
+ issues with updates and can prevent the latest code of a bundle being deployed.
+ If you know what you are doing then you can use maven-sling-plugin directly from the Maven CLI.
+ -->
+</project>
diff --git a/oauth/launcher/launch.sh b/oauth/launcher/launch.sh
new file mode 100755
index 0000000..36884d1
--- /dev/null
+++ b/oauth/launcher/launch.sh
@@ -0,0 +1,24 @@
+#!/bin/sh -eu
+#
+# 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.
+#
+
+echo '-------------------------------------------------------------------------------------------'
+echo '[NOTE] Launching application, this will fail if you did not build the project at least once'
+echo '[NOTE] Remove the launcher folder to throw away local changes'
+echo '-------------------------------------------------------------------------------------------'
+
+target/dependency/org.apache.sling.feature.launcher/bin/launcher -f target/slingfeature-tmp/feature-app.json
diff --git a/oauth/launcher/pom.xml b/oauth/launcher/pom.xml
new file mode 100644
index 0000000..7758ca2
--- /dev/null
+++ b/oauth/launcher/pom.xml
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!-- 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. -->
+<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/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.apache.sling.samples.oauth</artifactId>
+ <groupId>org.apache.sling.samples</groupId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.apache.sling.samples.oauth.launcher</artifactId>
+
+ <name>Sling OAuth Demo - Launcher</name>
+ <description>
+ This is a Module which contains a sample feature model build, built on
+ top of the Sling Starter and adding this project's artifacts.
+ </description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>slingfeature-maven-plugin</artifactId>
+ <extensions>true</extensions>
+
+ <configuration>
+ <skipAddFeatureDependencies>true</skipAddFeatureDependencies>
+ <framework>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>${org.apache.felix.framework.version}</version>
+ </framework>
+
+ <!--
+ Prepares a feature model aggregate that takes the following features from
+ the Sling Starter:
+ - nosample_base - the base Sling Starter
+ - oak_persistence_sns - SegmentNodeStore persistence for Oak
+ - composum - The Composum Nodes administration tool
+
+ Notably missing are the slingshot and starter samples
+ -->
+ <aggregates>
+ <aggregate>
+ <classifier>app</classifier>
+ <filesInclude>*.json</filesInclude>
+ <includeArtifact>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.extensions.oidc-rp</artifactId>
+ <classifier>app</classifier>
+ <version>0.1-SNAPSHOT</version>
+ <type>slingosgifeature</type>
+ </includeArtifact>
+ </aggregate>
+ </aggregates>
+ <scans>
+ <scan>
+ <includeClassifier>app</includeClassifier>
+ </scan>
+ </scans>
+ </configuration>
+ <executions>
+ <execution>
+ <id>prepare-features</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>aggregate-features</goal>
+ <goal>analyse-features</goal>
+ <goal>attach-features</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>prepare-feature-launcher</id>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.feature.launcher</artifactId>
+ <version>${org.apache.sling.feature.launcher.version}</version>
+ <type>tar.gz</type>
+ <!-- remove the version number from the unpacked folder -->
+ <fileMappers>
+ <org.codehaus.plexus.components.io.filemappers.RegExpFileMapper>
+ <pattern>\Qorg.apache.sling.feature.launcher-${org.apache.sling.feature.launcher.version}\E</pattern>
+ <replacement>org.apache.sling.feature.launcher</replacement>
+ </org.codehaus.plexus.components.io.filemappers.RegExpFileMapper>
+ </fileMappers>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/oauth/launcher/src/main/features/launcher.json b/oauth/launcher/src/main/features/launcher.json
new file mode 100644
index 0000000..430812b
--- /dev/null
+++ b/oauth/launcher/src/main/features/launcher.json
@@ -0,0 +1,13 @@
+{
+ "bundles": [
+ {
+ "id": "org.apache.sling.samples/org.apache.sling.samples.oauth.core/1.0-SNAPSHOT",
+ "start-order": 20
+ }
+ ],
+ "content-packages:ARTIFACTS|required": [
+ {
+ "id":"org.apache.sling.samples/org.apache.sling.samples.oauth.ui.apps/1.0-SNAPSHOT/zip"
+ }
+ ]
+}
diff --git a/oauth/pom.xml b/oauth/pom.xml
new file mode 100644
index 0000000..28196dd
--- /dev/null
+++ b/oauth/pom.xml
@@ -0,0 +1,2740 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ 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.
+--><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/maven-v4_0_0.xsd">
+
+
+
+
+
+
+ <modelVersion>4.0.0</modelVersion>
+
+
+
+
+
+
+ <groupId>org.apache.sling.samples</groupId>
+
+
+
+
+
+
+ <artifactId>org.apache.sling.samples.oauth</artifactId>
+
+
+
+
+
+
+ <version>1.0-SNAPSHOT</version>
+
+
+
+
+
+
+ <packaging>pom</packaging>
+
+
+
+
+
+
+ <name>Sling OAuth Demo</name>
+
+
+
+
+
+
+ <!--
+ ATTENTION: This archetype creates two modules: 'core' and 'ui.apps'
+ Both of these modules are empty and you can start filling
+ it in with your files.
+ There are two other modules: 'core.example' and 'ui.apps.example'
+ with have the same structure but have provide examples
+ for showing a Page with the usage of a Sling Model. The
+ idea is that a developer can copy any file he wants into
+ the regular module. Unfortunately the Maven Archetype
+ generating this project is adding all four modules to
+ this POM. Even though the POMs for the example modules
+ will not deploy it is best to remove them from this POM.
+
+ Look for the modules at the end of this file.
+ -->
+
+
+
+
+
+
+ <properties>
+
+
+
+
+
+
+ <sling.host>localhost</sling.host>
+
+
+
+
+
+
+ <sling.port>8080</sling.port>
+
+
+
+
+
+
+ <sling.user>admin</sling.user>
+
+
+
+
+
+
+ <sling.password>admin</sling.password>
+
+
+
+
+
+
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
+
+
+
+
+
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+
+
+
+
+
+
+ <release.plugin.version>2.5.3</release.plugin.version>
+
+
+
+
+
+
+ <source.plugin.version>3.0.1</source.plugin.version>
+
+
+
+
+
+
+ <resource.plugin.version>3.1.0</resource.plugin.version>
+
+
+
+
+
+
+ <jar.plugin.version>3.1.1</jar.plugin.version>
+
+
+
+
+
+
+ <enforcer.plugin.version>3.0.0-M2</enforcer.plugin.version>
+
+
+
+
+
+
+ <compiler.plugin.version>3.8.0</compiler.plugin.version>
+
+
+
+
+
+
+ <bundle.plugin.version>5.1.9</bundle.plugin.version>
+
+
+
+
+
+
+ <clean.plugin.version>3.1.0</clean.plugin.version>
+
+
+
+
+
+
+ <installer.plugin.version>3.0.0-M1</installer.plugin.version>
+
+
+
+
+
+
+ <surfire.plugin.version>3.0.0-M3</surfire.plugin.version>
+
+
+
+
+
+
+ <failsafe.plugin.version>3.0.0-M3</failsafe.plugin.version>
+
+
+
+
+
+
+ <deploy.plugin.version>3.0.0-M1</deploy.plugin.version>
+
+
+
+
+
+
+ <sling.plugin.version>2.4.0</sling.plugin.version>
+
+
+
+
+
+
+ <dependency.plugin.version>3.8.0</dependency.plugin.version>
+
+
+
+
+
+
+ <build.helper.plugin.version>3.0.0</build.helper.plugin.version>
+
+
+
+
+
+
+ <wcmio.plugin.version>1.7.6</wcmio.plugin.version>
+
+
+
+
+
+
+ <!-- TODO: Could not upgrade to 1.1.x as some tests prevent the creation of All packages -->
+
+
+
+
+
+
+ <filevault-package.plugin.version>1.0.4</filevault-package.plugin.version>
+
+
+
+
+
+
+ <slingfeature.plugin.version>1.8.4</slingfeature.plugin.version>
+
+
+
+
+
+
+ <osgi.core.version>7.0.0</osgi.core.version>
+
+
+
+
+
+
+ <osgi.annotation.version>7.0.0</osgi.annotation.version>
+
+
+
+
+
+
+ <org.osgi.service.component.annotations.version>1.4.0</org.osgi.service.component.annotations.version>
+
+
+
+
+
+
+ <org.osgi.service.metatype.annotations.version>1.4.0</org.osgi.service.metatype.annotations.version>
+
+
+
+
+
+
+ <org.osgi.compendium.version>5.0.0</org.osgi.compendium.version>
+
+
+
+
+
+
+ <javax.servlet-api.version>3.1.0</javax.servlet-api.version>
+
+
+
+
+
+
+ <javax.inject.version>1</javax.inject.version>
+
+
+
+
+
+
+ <jcr.version>2.0</jcr.version>
+
+
+
+
+
+
+ <org.apache.felix.framework.version>7.0.1</org.apache.felix.framework.version>
+
+
+
+
+
+
+ <org.apache.sling.api.version>2.22.0</org.apache.sling.api.version>
+
+
+
+
+
+
+ <org.apache.sling.models.api.version>1.3.8</org.apache.sling.models.api.version>
+
+
+
+
+
+
+ <org.apache.sling.feature.launcher.version>1.3.0</org.apache.sling.feature.launcher.version>
+
+
+
+
+
+
+ <jetbrains.annotations.version>19.0.0</jetbrains.annotations.version>
+
+
+
+
+
+
+ <org.apache.sling.settings.version>1.3.10</org.apache.sling.settings.version>
+
+
+
+
+
+
+ <org.apache.sling.commons.osgi.version>2.4.0</org.apache.sling.commons.osgi.version>
+
+
+
+
+
+
+ <jackrabbit-api.version>2.19.3</jackrabbit-api.version>
+
+
+
+
+
+
+ <commons-lang3.version>3.9</commons-lang3.version>
+
+
+
+
+
+
+ <jmock-junit4.version>2.8.2</jmock-junit4.version>
+
+
+
+
+
+
+
+
+
+
+
+ </properties>
+
+
+
+
+
+
+ <build>
+
+
+
+
+
+
+ <plugins>
+
+
+
+
+
+
+ <!-- Maven Release Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <groupId>org.apache.maven.plugins</groupId>
+
+
+
+
+
+
+ <artifactId>maven-release-plugin</artifactId>
+
+
+
+
+
+
+ <configuration>
+
+
+
+
+
+
+ <scmCommentPrefix>[maven-scm] :</scmCommentPrefix>
+
+
+
+
+
+
+ <preparationGoals>clean install</preparationGoals>
+
+
+
+
+
+
+ <goals>install</goals>
+
+
+
+
+
+
+ <releaseProfiles>release</releaseProfiles>
+
+
+
+
+
+
+ </configuration>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <!-- Maven Source Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <groupId>org.apache.maven.plugins</groupId>
+
+
+
+
+
+
+ <artifactId>maven-source-plugin</artifactId>
+
+
+
+
+
+
+ <inherited>true</inherited>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <!-- Maven Resources Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <groupId>org.apache.maven.plugins</groupId>
+
+
+
+
+
+
+ <artifactId>maven-resources-plugin</artifactId>
+
+
+
+
+
+
+ <configuration>
+
+
+
+
+
+
+ <encoding>UTF-8</encoding>
+
+
+
+
+
+
+ </configuration>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <!-- Maven Jar Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <groupId>org.apache.maven.plugins</groupId>
+
+
+
+
+
+
+ <artifactId>maven-jar-plugin</artifactId>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <!-- Maven Enforcer Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <groupId>org.apache.maven.plugins</groupId>
+
+
+
+
+
+
+ <artifactId>maven-enforcer-plugin</artifactId>
+
+
+
+
+
+
+ <executions>
+
+
+
+
+
+
+ <execution>
+
+
+
+
+
+
+ <id>enforce-maven</id>
+
+
+
+
+
+
+ <goals>
+
+
+
+
+
+
+ <goal>enforce</goal>
+
+
+
+
+
+
+ </goals>
+
+
+
+
+
+
+ <configuration>
+
+
+
+
+
+
+ <rules>
+
+
+
+
+
+
+ <requireMavenVersion>
+
+
+
+
+
+
+ <message>Project must be built with Maven 3.1.0 or higher</message>
+
+
+
+
+
+
+ <version>[3.1.0,)</version>
+
+
+
+
+
+
+ </requireMavenVersion>
+
+
+
+
+
+
+ <requireJavaVersion>
+
+
+
+
+
+
+ <message>Project must be compiled with Java 7 or higher</message>
+
+
+
+
+
+
+ <version>1.7.0</version>
+
+
+
+
+
+
+ </requireJavaVersion>
+
+
+
+
+
+
+ </rules>
+
+
+
+
+
+
+ </configuration>
+
+
+
+
+
+
+ </execution>
+
+
+
+
+
+
+ </executions>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <!-- Maven Compiler Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <groupId>org.apache.maven.plugins</groupId>
+
+
+
+
+
+
+ <artifactId>maven-compiler-plugin</artifactId>
+
+
+
+
+
+
+ <configuration>
+
+
+
+
+
+
+ <source>11</source>
+
+
+
+
+
+
+ <target>11</target>
+
+
+
+
+
+
+ <encoding>UTF-8</encoding>
+
+
+
+
+
+
+ </configuration>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ </plugins>
+
+
+
+
+
+
+ <pluginManagement>
+
+
+
+
+
+
+ <plugins>
+
+
+
+
+
+
+ <!-- Maven Release Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <artifactId>maven-release-plugin</artifactId>
+
+
+
+
+
+
+ <version>${release.plugin.version}</version>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <!-- Maven Source Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <artifactId>maven-source-plugin</artifactId>
+
+
+
+
+
+
+ <version>${source.plugin.version}</version>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <!-- Maven Resources Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <groupId>org.apache.maven.plugins</groupId>
+
+
+
+
+
+
+ <artifactId>maven-resources-plugin</artifactId>
+
+
+
+
+
+
+ <version>${resource.plugin.version}</version>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <!-- Maven Jar Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <groupId>org.apache.maven.plugins</groupId>
+
+
+
+
+
+
+ <artifactId>maven-jar-plugin</artifactId>
+
+
+
+
+
+
+ <version>${jar.plugin.version}</version>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <!-- Maven Enforcer Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <artifactId>maven-enforcer-plugin</artifactId>
+
+
+
+
+
+
+ <version>${enforcer.plugin.version}</version>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <!-- Maven Compiler Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <artifactId>maven-compiler-plugin</artifactId>
+
+
+
+
+
+
+ <version>${compiler.plugin.version}</version>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <!-- Maven Clean Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <groupId>org.apache.maven.plugins</groupId>
+
+
+
+
+
+
+ <artifactId>maven-clean-plugin</artifactId>
+
+
+
+
+
+
+ <version>${clean.plugin.version}</version>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <!-- Maven Installer Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <groupId>org.apache.maven.plugins</groupId>
+
+
+
+
+
+
+ <artifactId>maven-install-plugin</artifactId>
+
+
+
+
+
+
+ <version>${installer.plugin.version}</version>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <!-- Maven Surefire Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <groupId>org.apache.maven.plugins</groupId>
+
+
+
+
+
+
+ <artifactId>maven-surefire-plugin</artifactId>
+
+
+
+
+
+
+ <version>${surfire.plugin.version}</version>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <!-- Maven Failsafe Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <groupId>org.apache.maven.plugins</groupId>
+
+
+
+
+
+
+ <artifactId>maven-failsafe-plugin</artifactId>
+
+
+
+
+
+
+ <version>${failsafe.plugin.version}</version>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <!-- Maven Deploy Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <groupId>org.apache.maven.plugins</groupId>
+
+
+
+
+
+
+ <artifactId>maven-deploy-plugin</artifactId>
+
+
+
+
+
+
+ <version>${deploy.plugin.version}</version>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <!-- Apache Sling Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <groupId>org.apache.sling</groupId>
+
+
+
+
+
+
+ <artifactId>maven-sling-plugin</artifactId>
+
+
+
+
+
+
+ <version>${sling.plugin.version}</version>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <!-- Content Package Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <groupId>org.apache.jackrabbit</groupId>
+
+
+
+
+
+
+ <artifactId>filevault-package-maven-plugin</artifactId>
+
+
+
+
+
+
+ <version>${filevault-package.plugin.version}</version>
+
+
+
+
+
+
+ <extensions>true</extensions>
+
+
+
+
+
+
+ <configuration>
+
+
+
+
+
+
+ <failOnMissingEmbed>true</failOnMissingEmbed>
+
+
+
+
+
+
+ <force>true</force>
+
+
+
+
+
+
+ </configuration>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <groupId>io.wcm.maven.plugins</groupId>
+
+
+
+
+
+
+ <artifactId>wcmio-content-package-maven-plugin</artifactId>
+
+
+
+
+
+
+ <version>${wcmio.plugin.version}</version>
+
+
+
+
+
+
+ <configuration>
+
+
+
+
+
+
+ <serviceURL>http://${sling.host}:${sling.port}/bin/cpm/</serviceURL>
+
+
+
+
+
+
+ <userId>${sling.user}</userId>
+
+
+
+
+
+
+ <password>${sling.password}</password>
+
+
+
+
+
+
+ <failOnMissingEmbed>true</failOnMissingEmbed>
+
+
+
+
+
+
+ <force>true</force>
+
+
+
+
+
+
+ <group>sling-samples</group>
+
+
+
+
+
+
+ </configuration>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <!-- Apache Felix Bundle Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <groupId>org.apache.felix</groupId>
+
+
+
+
+
+
+ <artifactId>maven-bundle-plugin</artifactId>
+
+
+
+
+
+
+ <version>${bundle.plugin.version}</version>
+
+
+
+
+
+
+ <inherited>true</inherited>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <!-- Maven Dependency Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <groupId>org.apache.maven.plugins</groupId>
+
+
+
+
+
+
+ <artifactId>maven-dependency-plugin</artifactId>
+
+
+
+
+
+
+ <version>${dependency.plugin.version}</version>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <!-- Build Helper Maven Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <groupId>org.codehaus.mojo</groupId>
+
+
+
+
+
+
+ <artifactId>build-helper-maven-plugin</artifactId>
+
+
+
+
+
+
+ <version>${build.helper.plugin.version}</version>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ <!-- SlingFeature Plugin -->
+
+
+
+
+
+
+ <plugin>
+
+
+
+
+
+
+ <groupId>org.apache.sling</groupId>
+
+
+
+
+
+
+ <artifactId>slingfeature-maven-plugin</artifactId>
+
+
+
+
+
+
+ <version>${slingfeature.plugin.version}</version>
+
+
+
+
+
+
+ <dependencies>
+
+
+
+
+
+
+ <dependency>
+
+
+
+
+
+
+ <groupId>org.apache.sling</groupId>
+
+
+
+
+
+
+ <artifactId>org.apache.sling.feature.launcher</artifactId>
+
+
+
+
+
+
+ <version>${org.apache.sling.feature.launcher.version}</version>
+
+
+
+
+
+
+ </dependency>
+
+
+
+
+
+
+ </dependencies>
+
+
+
+
+
+
+ </plugin>
+
+
+
+
+
+
+ </plugins>
+
+
+
+
+
+
+ </pluginManagement>
+
+
+
+
+
+
+ </build>
+
+
+
+
+
+
+ <!-- ====================================================================== -->
+
+
+
+
+
+
+ <!-- D E P E N D E N C I E S -->
+
+
+
+
+
+
+ <!-- ====================================================================== -->
+
+
+
+
+
+
+ <dependencyManagement>
+
+
+
+
+
+
+ <dependencies>
+
+
+
+
+
+
+ <!-- OSGi Dependencies -->
+
+
+
+
+
+
+ <dependency>
+
+
+
+
+
+
+ <groupId>org.osgi</groupId>
+
+
+
+
+
+
+ <artifactId>osgi.core</artifactId>
+
+
+
+
+
+
+ <version>${osgi.core.version}</version>
+
+
+
+
+
+
+ <scope>provided</scope>
+
+
+
+
+
+
+ </dependency>
+
+
+
+
+
+
+ <!-- OSGi annotations: @Version, @ProviderType, @ConsumerType -->
+
+
+
+
+
+
+ <dependency>
+
+
+
+
+
+
+ <groupId>org.osgi</groupId>
+
+
+
+
+
+
+ <artifactId>osgi.annotation</artifactId>
+
+
+
+
+
+
+ <version>${osgi.annotation.version}</version>
+
+
+
+
+
+
+ <scope>provided</scope>
+
+
+
+
+
+
+ </dependency>
+
+
+
+
+
+
+ <!-- OSGi annotations for DS and metatype -->
+
+
+
+
+
+
+ <dependency>
+
+
+
+
+
+
+ <groupId>org.osgi</groupId>
+
+
+
+
+
+
+ <artifactId>org.osgi.service.component.annotations</artifactId>
+
+
+
+
+
+
+ <version>${org.osgi.service.component.annotations.version}</version>
+
+
+
+
+
+
+ <scope>provided</scope>
+
+
+
+
+
+
+ </dependency>
+
+
+
+
+
+
+ <dependency>
+
+
+
+
+
+
+ <groupId>org.osgi</groupId>
+
+
+
+
+
+
+ <artifactId>org.osgi.service.metatype.annotations</artifactId>
+
+
+
+
+
+
+ <version>${org.osgi.service.metatype.annotations.version}</version>
+
+
+
+
+
+
+ <scope>provided</scope>
+
+
+
+
+
+
+ </dependency>
+
+
+
+
+
+
+ <!-- Needs to be placed after 'org.osgi.service.component.annotations' otherwise field @Reference will not work -->
+
+
+
+
+
+
+ <dependency>
+
+
+
+
+
+
+ <groupId>org.osgi</groupId>
+
+
+
+
+
+
+ <artifactId>org.osgi.compendium</artifactId>
+
+
+
+
+
+
+ <version>${org.osgi.compendium.version}</version>
+
+
+
+
+
+
+ <scope>provided</scope>
+
+
+
+
+
+
+ </dependency>
+
+
+
+
+
+
+ <!-- Web Application API -->
+
+
+
+
+
+
+ <dependency>
+
+
+
+
+
+
+ <groupId>javax.servlet</groupId>
+
+
+
+
+
+
+ <artifactId>javax.servlet-api</artifactId>
+
+
+
+
+
+
+ <version>${javax.servlet-api.version}</version>
+
+
+
+
+
+
+ <scope>provided</scope>
+
+
+
+
+
+
+ </dependency>
+
+
+
+
+
+
+ <!-- dependency injection annotations -->
+
+
+
+
+
+
+ <dependency>
+
+
+
+
+
+
+ <groupId>javax.inject</groupId>
+
+
+
+
+
+
+ <artifactId>javax.inject</artifactId>
+
+
+
+
+
+
+ <version>$[javax.inject.version</version>
+
+
+
+
+
+
+ <scope>provided</scope>
+
+
+
+
+
+
+ </dependency>
+
+
+
+
+
+
+ <!-- JCR API -->
+
+
+
+
+
+
+ <dependency>
+
+
+
+
+
+
+ <groupId>javax.jcr</groupId>
+
+
+
+
+
+
+ <artifactId>jcr</artifactId>
+
+
+
+
+
+
+ <version>${jcr.version}</version>
+
+
+
+
+
+
+ <scope>provided</scope>
+
+
+
+
+
+
+ </dependency>
+
+
+
+
+
+
+ <!-- Basic Logging -->
+
+
+
+
+
+
+ <dependency>
+
+
+
+
+
+
+ <groupId>org.slf4j</groupId>
+
+
+
+
+
+
+ <artifactId>slf4j-api</artifactId>
+
+
+
+
+
+
+ <version>1.7.25</version>
+
+
+
+
+
+
+ <scope>provided</scope>
+
+
+
+
+
+
+ </dependency>
+
+
+
+
+
+
+ <dependency>
+
+
+
+
+
+
+ <groupId>org.jetbrains</groupId>
+
+
+
+
+
+
+ <artifactId>annotations</artifactId>
+
+
+
+
+
+
+ <version>${jetbrains.annotations.version}</version>
+
+
+
+
+
+
+ <scope>provided</scope>
+
+
+
+
+
+
+ </dependency>
+
+
+
+
+
+
+ <!-- Apache Sling Dependencies -->
+
+
+
+
+
+
+ <dependency>
+
+
+
+
+
+
+ <groupId>org.apache.sling</groupId>
+
+
+
+
+
+
+ <artifactId>org.apache.sling.api</artifactId>
+
+
+
+
+
+
+ <version>${org.apache.sling.api.version}</version>
+
+
+
+
+
+
+ <scope>provided</scope>
+
+
+
+
+
+
+ </dependency>
+
+
+
+
+
+
+ <dependency>
+
+
+
+
+
+
+ <groupId>org.apache.sling</groupId>
+
+
+
+
+
+
+ <artifactId>org.apache.sling.settings</artifactId>
+
+
+
+
+
+
+ <version>${org.apache.sling.settings.version}</version>
+
+
+
+
+
+
+ <scope>provided</scope>
+
+
+
+
+
+
+ </dependency>
+
+
+
+
+
+
+ <dependency>
+
+
+
+
+
+
+ <groupId>org.apache.sling</groupId>
+
+
+
+
+
+
+ <artifactId>org.apache.sling.commons.osgi</artifactId>
+
+
+
+
+
+
+ <version>${org.apache.sling.commons.osgi.version}</version>
+
+
+
+
+
+
+ <scope>provided</scope>
+
+
+
+
+
+
+ </dependency>
+
+
+
+
+
+
+ <dependency>
+
+
+
+
+
+
+ <groupId>org.apache.sling</groupId>
+
+
+
+
+
+
+ <artifactId>org.apache.sling.models.api</artifactId>
+
+
+
+
+
+
+ <version>${org.apache.sling.models.api.version}</version>
+
+
+
+
+
+
+ <scope>provided</scope>
+
+
+
+
+
+
+ </dependency>
+
+
+
+
+
+
+ <dependency>
+
+
+
+
+
+
+ <groupId>org.apache.jackrabbit</groupId>
+
+
+
+
+
+
+ <artifactId>jackrabbit-api</artifactId>
+
+
+
+
+
+
+ <version>${jackrabbit-api.version}</version>
+
+
+
+
+
+
+ <scope>provided</scope>
+
+
+
+
+
+
+ </dependency>
+
+
+
+
+
+
+ <!-- Support -->
+
+
+
+
+
+
+ <dependency>
+
+
+
+
+
+
+ <groupId>org.apache.commons</groupId>
+
+
+
+
+
+
+ <artifactId>commons-lang3</artifactId>
+
+
+
+
+
+
+ <version>${commons-lang3.version}</version>
+
+
+
+
+
+
+ <scope>provided</scope>
+
+
+
+
+
+
+ </dependency>
+
+
+
+
+
+
+ <!-- Basic dependencies for Unit Tests -->
+
+
+
+
+
+
+ <dependency>
+
+
+
+
+
+
+ <groupId>junit</groupId>
+
+
+
+
+
+
+ <artifactId>junit</artifactId>
+
+
+
+
+
+
+ <version>4.12</version>
+
+
+
+
+
+
+ <scope>test</scope>
+
+
+
+
+
+
+ </dependency>
+
+
+
+
+
+
+ <dependency>
+
+
+
+
+
+
+ <groupId>org.jmock</groupId>
+
+
+
+
+
+
+ <artifactId>jmock-junit4</artifactId>
+
+
+
+
+
+
+ <version>${jmock-junit4.version}</version>
+
+
+
+
+
+
+ <scope>test</scope>
+
+
+
+
+
+
+ </dependency>
+
+
+
+
+
+
+ <dependency>
+
+
+
+
+
+
+ <groupId>org.slf4j</groupId>
+
+
+
+
+
+
+ <artifactId>slf4j-simple</artifactId>
+
+
+
+
+
+
+ <version>1.7.25</version>
+
+
+
+
+
+
+ <scope>test</scope>
+
+
+
+
+
+
+ </dependency>
+
+
+
+
+
+
+ </dependencies>
+
+
+
+
+
+
+ </dependencyManagement>
+
+
+
+
+
+
+ <modules>
+
+
+
+
+
+
+ <module>core</module>
+
+
+
+
+
+ <module>ui.apps</module>
+
+
+
+ <module>launcher</module>
+
+
+ <module>all</module>
+
+ </modules>
+
+
+
+
+
+</project>
diff --git a/oauth/ui.apps/pom.xml b/oauth/ui.apps/pom.xml
new file mode 100644
index 0000000..c49c6eb
--- /dev/null
+++ b/oauth/ui.apps/pom.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<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/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.apache.sling.samples.oauth</artifactId>
+ <groupId>org.apache.sling.samples</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.apache.sling.samples.oauth.ui.apps</artifactId>
+ <packaging>content-package</packaging>
+
+ <name>Sling OAuth Demo - UI Apps</name>
+ <description>
+ This is an empty JCR Package where the JCR Content
+ can be deployed with.
+ </description>
+ <!-- NOTE:
+ For a 'not all' package this JCR Package will embedd
+ the "core" bundle. It can be deployed with the
+ "autoInstallPackage" profile.
+
+ For an 'all' package this only provides the content
+ of the project which is deployed in the root with
+ the "autoInstallAll" profile.
+
+ It is advisable to deploy any bundles or packages
+ in one manner as deploying bundles inside a package
+ and through the System Console can lead to unexpected
+ and errorneous situations.
+ -->
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>filevault-package-maven-plugin</artifactId>
+ <configuration>
+ <filterSource>${basedir}/src/main/content/META-INF/vault/filter.xml</filterSource>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/oauth/ui.apps/src/main/content/META-INF/vault/filter.xml b/oauth/ui.apps/src/main/content/META-INF/vault/filter.xml
new file mode 100644
index 0000000..3f37a9f
--- /dev/null
+++ b/oauth/ui.apps/src/main/content/META-INF/vault/filter.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<workspaceFilter version="1.0">
+ <!--
+ Any node that will contain customer data needs to be excluded
+ otherwise a Pacakge Installation will wipe them.
+
+ If there is a mix then all provided nodes must be included and
+ all custom nodes excluded.
+
+ If unsure what to do then go to the Composum Package Manager
+ (/bin/packages.html) and create a test package. To to the package
+ filter list and add filter entries until all of the app provides
+ nodes are included but none of the customer generatedd nodes.
+
+ Also any sub pckage of this module needs to exclude /apps/oauth-demo/install
+ folder otherwise they wipe all installed bundles.
+ -->
+ <filter root="/content/oauth-demo"/>
+ <!--
+ Need to exclude the Install folder otherwise the Bundle will be undeployed
+ as it is in the '/apps/oauth-demo/install' folder (see the 'all'
+ package).
+ -->
+ <filter root="/apps/oauth-demo">
+ <exclude pattern="/apps/oauth-demo/install/.*"/>
+ </filter>
+</workspaceFilter>
diff --git a/oauth/ui.apps/src/main/content/META-INF/vault/settings.xml b/oauth/ui.apps/src/main/content/META-INF/vault/settings.xml
new file mode 100644
index 0000000..b70c9b9
--- /dev/null
+++ b/oauth/ui.apps/src/main/content/META-INF/vault/settings.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<vault version="1.0">
+ <ignore name=".svn"/>
+ <ignore name=".git"/>
+</vault>
diff --git a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/.content.xml b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/.content.xml
new file mode 100644
index 0000000..0cf5506
--- /dev/null
+++ b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/.content.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
+ jcr:primaryType="sling:Folder"
+ jcr:title="Sling OAuth Demo Root"
+ jcr:description="Sling OAuth Demo Apps Root folder"
+/>
\ No newline at end of file
diff --git a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/install/.content.xml b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/install/.content.xml
new file mode 100644
index 0000000..42debc9
--- /dev/null
+++ b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/install/.content.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
+ jcr:primaryType="sling:Folder"
+ jcr:title="Install Folder"
+/>
diff --git a/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/.content.xml b/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/.content.xml
new file mode 100644
index 0000000..2d247a2
--- /dev/null
+++ b/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/.content.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
+ jcr:primaryType="sling:Folder"
+ jcr:title="Sling OAuth Demo"
+ jcr:description="Sling OAuth Demo Content Root"
+/>
\ No newline at end of file
(sling-samples) 02/15: feat: working on end-to-end flow
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-samples.git
commit da759fbe6c80ea7364520b1e886b084efb0bc7b3
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Mon Sep 9 18:46:00 2024 +0200
feat: working on end-to-end flow
---
oauth/core/pom.xml | 47 +++++++--
.../org/apache/sling/samples/oauth_demo/Error.java | 9 ++
.../sling/samples/oauth_demo/ErrorDetail.java | 7 ++
.../org/apache/sling/samples/oauth_demo/Id.java | 6 ++
.../org/apache/sling/samples/oauth_demo/Item.java | 8 ++
.../apache/sling/samples/oauth_demo/PageInfo.java | 6 ++
.../apache/sling/samples/oauth_demo/Snippet.java | 12 +++
.../apache/sling/samples/oauth_demo/Thumbnail.java | 7 ++
.../sling/samples/oauth_demo/Thumbnails.java | 9 ++
.../samples/oauth_demo/YoutubeSearchResponse.java | 13 +++
.../samples/oauth_demo/YoutubeVideosModel.java | 32 ++++++
.../samples/oauth_demo/impl/YoutubeHttpClient.java | 53 ++++++++++
.../oauth_demo/impl/YoutubeSearchServlet.java | 107 +++++++++++++++++++++
.../sling/samples/oauth_demo/package-info.java | 18 ++++
oauth/launcher/src/main/features/launcher.json | 6 +-
oauth/pom.xml | 4 +-
.../oauth-demo/components}/.content.xml | 6 +-
.../oauth-demo/components/welcome}/.content.xml | 6 +-
.../apps/oauth-demo/components/welcome/output.css | 1 +
.../oauth-demo/components/welcome/welcome.html | 13 +++
.../components/youtube-videos}/.content.xml | 6 +-
.../oauth-demo/components/youtube-videos/show.html | 12 +++
.../jcr_root/content/oauth-demo/.content.xml | 4 +-
.../content/oauth-demo/{ => videos}/.content.xml | 4 +-
24 files changed, 368 insertions(+), 28 deletions(-)
diff --git a/oauth/core/pom.xml b/oauth/core/pom.xml
index d7dc281..1feabe1 100644
--- a/oauth/core/pom.xml
+++ b/oauth/core/pom.xml
@@ -53,7 +53,7 @@
<configuration>
<instructions>
<Embed-Dependency>*;scope=compile;inline=true</Embed-Dependency>
- <Sling-Model-Packages>org.apache.sling.samples.oauth.model</Sling-Model-Packages>
+ <Sling-Model-Packages>org.apache.sling.samples.oauth_demo</Sling-Model-Packages>
<_dsannotations>*</_dsannotations>
<_metatypeannotations>*</_metatypeannotations>
<_removeheaders>
@@ -68,8 +68,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
- <source>11</source>
- <target>11</target>
+ <source>21</source>
+ <target>21</target>
</configuration>
</plugin>
<plugin>
@@ -125,6 +125,13 @@
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-api</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.servlets.annotations</artifactId>
+ <version>1.2.4</version>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
@@ -140,11 +147,33 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.extensions.oidc-rp</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>2.13.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>2.13.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>2.13.0</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
-
- <!--
- Attention: the autoInstallBundle was removed as deploying bundles directly and through a package is causing
- issues with updates and can prevent the latest code of a bundle being deployed.
- If you know what you are doing then you can use maven-sling-plugin directly from the Maven CLI.
- -->
</project>
diff --git a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Error.java b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Error.java
new file mode 100644
index 0000000..3e3cec3
--- /dev/null
+++ b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Error.java
@@ -0,0 +1,9 @@
+package org.apache.sling.samples.oauth_demo;
+
+import java.util.List;
+
+public record Error (
+ int code,
+ String message,
+ List<ErrorDetail> errors
+) {}
\ No newline at end of file
diff --git a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/ErrorDetail.java b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/ErrorDetail.java
new file mode 100644
index 0000000..7cb0bc7
--- /dev/null
+++ b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/ErrorDetail.java
@@ -0,0 +1,7 @@
+package org.apache.sling.samples.oauth_demo;
+
+public record ErrorDetail (
+ String message,
+ String domain,
+ String reason
+) {}
\ No newline at end of file
diff --git a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Id.java b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Id.java
new file mode 100644
index 0000000..35d4c4e
--- /dev/null
+++ b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Id.java
@@ -0,0 +1,6 @@
+package org.apache.sling.samples.oauth_demo;
+
+public record Id (
+ String kind,
+ String videoId
+) {}
\ No newline at end of file
diff --git a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Item.java b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Item.java
new file mode 100644
index 0000000..1d6ca47
--- /dev/null
+++ b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Item.java
@@ -0,0 +1,8 @@
+package org.apache.sling.samples.oauth_demo;
+
+public record Item (
+ String kind,
+ String etag,
+ Id id,
+ Snippet snippet
+) {}
\ No newline at end of file
diff --git a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/PageInfo.java b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/PageInfo.java
new file mode 100644
index 0000000..88a550f
--- /dev/null
+++ b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/PageInfo.java
@@ -0,0 +1,6 @@
+package org.apache.sling.samples.oauth_demo;
+
+public record PageInfo (
+ int totalResults,
+ int resultsPerPage
+) {}
\ No newline at end of file
diff --git a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Snippet.java b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Snippet.java
new file mode 100644
index 0000000..18f11ae
--- /dev/null
+++ b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Snippet.java
@@ -0,0 +1,12 @@
+package org.apache.sling.samples.oauth_demo;
+
+public record Snippet (
+ String publishedAt,
+ String channelId,
+ String title,
+ String description,
+ Thumbnails thumbnails,
+ String channelTitle,
+ String liveBroadcastContent,
+ String publishTime
+) {}
\ No newline at end of file
diff --git a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Thumbnail.java b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Thumbnail.java
new file mode 100644
index 0000000..8a5ae8a
--- /dev/null
+++ b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Thumbnail.java
@@ -0,0 +1,7 @@
+package org.apache.sling.samples.oauth_demo;
+
+public record Thumbnail (
+ String url,
+ int width,
+ int height
+) {}
\ No newline at end of file
diff --git a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Thumbnails.java b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Thumbnails.java
new file mode 100644
index 0000000..226c884
--- /dev/null
+++ b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/Thumbnails.java
@@ -0,0 +1,9 @@
+package org.apache.sling.samples.oauth_demo;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public record Thumbnails (
+ @JsonProperty("default") Thumbnail defaultThumbnail,
+ Thumbnail medium,
+ Thumbnail high
+) {}
\ No newline at end of file
diff --git a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/YoutubeSearchResponse.java b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/YoutubeSearchResponse.java
new file mode 100644
index 0000000..88fabb2
--- /dev/null
+++ b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/YoutubeSearchResponse.java
@@ -0,0 +1,13 @@
+package org.apache.sling.samples.oauth_demo;
+
+import java.util.List;
+
+public record YoutubeSearchResponse (
+ String kind,
+ String etag,
+ String nextPageToken,
+ String regionCode,
+ PageInfo pageInfo,
+ List<Item> items,
+ Error error
+) {}
\ No newline at end of file
diff --git a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/YoutubeVideosModel.java b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/YoutubeVideosModel.java
new file mode 100644
index 0000000..f4178ac
--- /dev/null
+++ b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/YoutubeVideosModel.java
@@ -0,0 +1,32 @@
+/*
+ * 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 org.apache.sling.samples.oauth_demo;
+
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.models.annotations.Model;
+import org.apache.sling.models.annotations.injectorspecific.SlingObject;
+
+@Model(adaptables = SlingHttpServletRequest.class)
+public class YoutubeVideosModel {
+
+ @SlingObject
+ private SlingHttpServletRequest request;
+
+ public YoutubeSearchResponse getResponse() {
+ return (YoutubeSearchResponse) request.getAttribute("ytResponse");
+ }
+}
diff --git a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeHttpClient.java b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeHttpClient.java
new file mode 100644
index 0000000..43e2789
--- /dev/null
+++ b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeHttpClient.java
@@ -0,0 +1,53 @@
+/*
+ * 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 org.apache.sling.samples.oauth_demo.impl;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.net.http.HttpResponse.BodyHandlers;
+
+import org.apache.sling.samples.oauth_demo.YoutubeSearchResponse;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class YoutubeHttpClient {
+
+ public static final String API_BASE = "https://youtube.googleapis.com/youtube/v3";
+
+ public YoutubeSearchResponse searchVideos(String query, String accessToken) throws IOException, InterruptedException {
+
+ try ( HttpClient client = HttpClient.newHttpClient() ) {
+ HttpRequest searchRequest = HttpRequest.newBuilder()
+ .uri(URI.create(API_BASE + "/search?part=snippet&maxResults=20&q=" + query + "&type=video"))
+ .header("Authorization", "Bearer " + accessToken)
+ .header("Accept", "application/json")
+ .build();
+
+ HttpResponse<String> response = client.send(searchRequest, BodyHandlers.ofString());
+
+ String body = response.body();
+
+ System.out.println(body);
+
+ ObjectMapper mapper = new ObjectMapper();
+ return mapper.reader().readValue(body, YoutubeSearchResponse.class);
+ }
+ }
+}
\ No newline at end of file
diff --git a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeSearchServlet.java b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeSearchServlet.java
new file mode 100644
index 0000000..5aa6d2d
--- /dev/null
+++ b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeSearchServlet.java
@@ -0,0 +1,107 @@
+/*
+ * 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 org.apache.sling.samples.oauth_demo.impl;
+
+import java.io.IOException;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.request.RequestDispatcherOptions;
+import org.apache.sling.extensions.oidc_rp.OidcClient;
+import org.apache.sling.extensions.oidc_rp.OidcConnection;
+import org.apache.sling.extensions.oidc_rp.OidcToken;
+import org.apache.sling.extensions.oidc_rp.OidcTokenStore;
+import org.apache.sling.extensions.oidc_rp.support.OAuthEnabledSlingServlet;
+import org.apache.sling.samples.oauth_demo.YoutubeSearchResponse;
+import org.apache.sling.servlets.annotations.SlingServletResourceTypes;
+import org.jetbrains.annotations.NotNull;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+
+@Component(service = { Servlet.class })
+@SlingServletResourceTypes(resourceTypes = "oauth-demo/components/youtube-videos", methods = "GET", extensions = "html")
+public class YoutubeSearchServlet extends OAuthEnabledSlingServlet {
+
+ private static final long serialVersionUID = 1L;
+ private final OidcConnection connection;
+ private OidcTokenStore tokenStore;
+ private OidcClient oidcClient;
+
+ @Activate
+ public YoutubeSearchServlet(@Reference OidcConnection connection, @Reference OidcTokenStore tokenStore, @Reference OidcClient oidcClient) {
+ this.connection = connection;
+ this.tokenStore = tokenStore;
+ this.oidcClient = oidcClient;
+ }
+
+ @Override
+ protected @NotNull String getRedirectPath(@NotNull SlingHttpServletRequest request) {
+ return request.getRequestURI();
+ }
+
+ @Override
+ protected @NotNull OidcConnection getConnection() {
+ return connection;
+ }
+
+ @Override
+ protected @NotNull OidcClient getOidcClient() {
+ return oidcClient;
+ }
+
+ @Override
+ protected @NotNull OidcTokenStore getTokenStore() {
+ return tokenStore;
+ }
+
+ @Override
+ protected void doGetWithToken(@NotNull SlingHttpServletRequest request, @NotNull SlingHttpServletResponse response,
+ OidcToken token) throws IOException, ServletException {
+
+ try {
+ YoutubeHttpClient client = new YoutubeHttpClient();
+ YoutubeSearchResponse youtubeResponse = client.searchVideos("adaptTo", token.getValue());
+
+ RequestDispatcherOptions opts = new RequestDispatcherOptions();
+ opts.setReplaceSelectors("show");
+
+ request.setAttribute("ytResponse", youtubeResponse);
+ response.setContentType("text/html");
+ request.getRequestDispatcher(request.getResource(), opts).include(request, response);
+
+ // TODO - needs a thin use object shim to expose the request attribute or a generic BVP
+
+// response.setStatus(HttpServletResponse.SC_OK);
+// response.setContentType("text/html");
+// response.getWriter().write(String.format("<p>Got %s results out of total %s</p>", youtubeResponse.items().size(), youtubeResponse.pageInfo().totalResults()));
+// response.getWriter().write("<ul>");
+// for (Item item : youtubeResponse.items()) {
+// response.getWriter().write(String.format("<li><a href=\"https://www.youtube.com/watch?v=%s\">%s</a></li>",
+// item.id().videoId(), item.snippet().title()));
+// }
+// response.getWriter().write("</ul>");
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Please retry later");
+ }
+ }
+}
diff --git a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/package-info.java b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/package-info.java
new file mode 100644
index 0000000..1174b9b
--- /dev/null
+++ b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/package-info.java
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
+@org.osgi.annotation.versioning.Version("1.0.0")
+package org.apache.sling.samples.oauth_demo;
\ No newline at end of file
diff --git a/oauth/launcher/src/main/features/launcher.json b/oauth/launcher/src/main/features/launcher.json
index 430812b..0334e9a 100644
--- a/oauth/launcher/src/main/features/launcher.json
+++ b/oauth/launcher/src/main/features/launcher.json
@@ -2,7 +2,11 @@
"bundles": [
{
"id": "org.apache.sling.samples/org.apache.sling.samples.oauth.core/1.0-SNAPSHOT",
- "start-order": 20
+ "start-order": 25
+ },
+ {
+ "id": "org.apache.sling/org.apache.sling.extensions.oidc-rp/0.1-SNAPSHOT",
+ "start-order": 24
}
],
"content-packages:ARTIFACTS|required": [
diff --git a/oauth/pom.xml b/oauth/pom.xml
index 28196dd..3698d86 100644
--- a/oauth/pom.xml
+++ b/oauth/pom.xml
@@ -840,14 +840,14 @@
- <source>11</source>
+ <source>21</source>
- <target>11</target>
+ <target>21</target>
diff --git a/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/.content.xml b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/.content.xml
similarity index 82%
copy from oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/.content.xml
copy to oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/.content.xml
index 2d247a2..20e138a 100644
--- a/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/.content.xml
+++ b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/.content.xml
@@ -17,8 +17,6 @@
specific language governing permissions and limitations
under the License.
-->
-<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
+<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:Folder"
- jcr:title="Sling OAuth Demo"
- jcr:description="Sling OAuth Demo Content Root"
-/>
\ No newline at end of file
+/>
diff --git a/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/.content.xml b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/.content.xml
similarity index 82%
copy from oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/.content.xml
copy to oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/.content.xml
index 2d247a2..20e138a 100644
--- a/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/.content.xml
+++ b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/.content.xml
@@ -17,8 +17,6 @@
specific language governing permissions and limitations
under the License.
-->
-<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
+<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:Folder"
- jcr:title="Sling OAuth Demo"
- jcr:description="Sling OAuth Demo Content Root"
-/>
\ No newline at end of file
+/>
diff --git a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/output.css b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/output.css
new file mode 100644
index 0000000..c12b6dd
--- /dev/null
+++ b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/output.css
@@ -0,0 +1 @@
+/*! tailwindcss v3.4.10 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inheri [...]
\ No newline at end of file
diff --git a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/welcome.html b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/welcome.html
new file mode 100644
index 0000000..7882f74
--- /dev/null
+++ b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/welcome/welcome.html
@@ -0,0 +1,13 @@
+<!doctype html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <link href="./output.css" rel="stylesheet">
+</head>
+<body>
+<h1 class="text-3xl font-bold underline">OAuth Demo</h1>
+<p>Welcome to the Sling OAuth demo.</p>
+<p>Access the <a href="oauth-demo/videos.html">YouTube videos</a> page.</p>
+</body>
+</html>
diff --git a/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/.content.xml b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/.content.xml
similarity index 82%
copy from oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/.content.xml
copy to oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/.content.xml
index 2d247a2..20e138a 100644
--- a/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/.content.xml
+++ b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/.content.xml
@@ -17,8 +17,6 @@
specific language governing permissions and limitations
under the License.
-->
-<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
+<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:Folder"
- jcr:title="Sling OAuth Demo"
- jcr:description="Sling OAuth Demo Content Root"
-/>
\ No newline at end of file
+/>
diff --git a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
new file mode 100644
index 0000000..3da0ae5
--- /dev/null
+++ b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
@@ -0,0 +1,12 @@
+<!doctype html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+</head>
+<body data-sly-use.youtube="org.apache.sling.samples.oauth_demo.YoutubeVideosModel">
+<h1>Search results</h1>
+<p>ERROR? ${youtube.response.error.message}</p>
+<p>Got ${youtube.response.items.size} results of out total ${youtube.response.pageInfo.totalResults}</p>
+</body>
+</html>
\ No newline at end of file
diff --git a/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/.content.xml b/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/.content.xml
index 2d247a2..a731489 100644
--- a/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/.content.xml
+++ b/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/.content.xml
@@ -18,7 +18,7 @@
under the License.
-->
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
+ xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
jcr:primaryType="sling:Folder"
- jcr:title="Sling OAuth Demo"
- jcr:description="Sling OAuth Demo Content Root"
+ sling:resourceType="oauth-demo/components/welcome"
/>
\ No newline at end of file
diff --git a/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/.content.xml b/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/videos/.content.xml
similarity index 88%
copy from oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/.content.xml
copy to oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/videos/.content.xml
index 2d247a2..bfb8f19 100644
--- a/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/.content.xml
+++ b/oauth/ui.apps/src/main/content/jcr_root/content/oauth-demo/videos/.content.xml
@@ -18,7 +18,7 @@
under the License.
-->
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
+ xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
jcr:primaryType="sling:Folder"
- jcr:title="Sling OAuth Demo"
- jcr:description="Sling OAuth Demo Content Root"
+ sling:resourceType="oauth-demo/components/youtube-videos"
/>
\ No newline at end of file
(sling-samples) 07/15: feat: allow searching for the youtube page
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-samples.git
commit cc2a54ee3d1ec40297b19a92f9678bc487d4e9de
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Tue Sep 10 17:33:48 2024 +0200
feat: allow searching for the youtube page
---
.../sling/samples/oauth_demo/YoutubeVideosModel.java | 4 ++++
.../samples/oauth_demo/impl/YoutubeHttpClient.java | 3 +++
.../samples/oauth_demo/impl/YoutubeSearchServlet.java | 19 ++++++-------------
.../oauth-demo/components/youtube-videos/show.html | 7 ++++++-
4 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/YoutubeVideosModel.java b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/YoutubeVideosModel.java
index f4178ac..22ffc75 100644
--- a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/YoutubeVideosModel.java
+++ b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/YoutubeVideosModel.java
@@ -29,4 +29,8 @@ public class YoutubeVideosModel {
public YoutubeSearchResponse getResponse() {
return (YoutubeSearchResponse) request.getAttribute("ytResponse");
}
+
+ public String getSearch() {
+ return request.getParameter("search");
+ }
}
diff --git a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeHttpClient.java b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeHttpClient.java
index 43e2789..fe153ce 100644
--- a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeHttpClient.java
+++ b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeHttpClient.java
@@ -18,10 +18,12 @@ package org.apache.sling.samples.oauth_demo.impl;
import java.io.IOException;
import java.net.URI;
+import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
+import java.nio.charset.StandardCharsets;
import org.apache.sling.samples.oauth_demo.YoutubeSearchResponse;
@@ -34,6 +36,7 @@ public class YoutubeHttpClient {
public YoutubeSearchResponse searchVideos(String query, String accessToken) throws IOException, InterruptedException {
try ( HttpClient client = HttpClient.newHttpClient() ) {
+ query = URLEncoder.encode(query.trim(), StandardCharsets.UTF_8);
HttpRequest searchRequest = HttpRequest.newBuilder()
.uri(URI.create(API_BASE + "/search?part=snippet&maxResults=20&q=" + query + "&type=video"))
.header("Authorization", "Bearer " + accessToken)
diff --git a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeSearchServlet.java b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeSearchServlet.java
index cec6692..beac6e4 100644
--- a/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeSearchServlet.java
+++ b/oauth/core/src/main/java/org/apache/sling/samples/oauth_demo/impl/YoutubeSearchServlet.java
@@ -78,25 +78,18 @@ public class YoutubeSearchServlet extends OAuthEnabledSlingServlet {
OidcToken token) throws IOException, ServletException {
try {
- YoutubeHttpClient client = new YoutubeHttpClient();
- YoutubeSearchResponse youtubeResponse = client.searchVideos("adaptTo", token.getValue());
+ String search = request.getParameter("search");
+ if (search != null && !search.isBlank()) {
+ YoutubeHttpClient client = new YoutubeHttpClient();
+ YoutubeSearchResponse youtubeResponse = client.searchVideos(search, token.getValue());
+ request.setAttribute("ytResponse", youtubeResponse);
+ }
RequestDispatcherOptions opts = new RequestDispatcherOptions();
opts.setReplaceSelectors("show");
- request.setAttribute("ytResponse", youtubeResponse);
response.setContentType("text/html");
request.getRequestDispatcher(request.getResource(), opts).include(request, response);
-
-// response.setStatus(HttpServletResponse.SC_OK);
-// response.setContentType("text/html");
-// response.getWriter().write(String.format("<p>Got %s results out of total %s</p>", youtubeResponse.items().size(), youtubeResponse.pageInfo().totalResults()));
-// response.getWriter().write("<ul>");
-// for (Item item : youtubeResponse.items()) {
-// response.getWriter().write(String.format("<li><a href=\"https://www.youtube.com/watch?v=%s\">%s</a></li>",
-// item.id().videoId(), item.snippet().title()));
-// }
-// response.getWriter().write("</ul>");
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Please retry later");
diff --git a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
index 57c4cf1..451da12 100644
--- a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
+++ b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
@@ -7,7 +7,12 @@
</head>
<body data-sly-use.youtube="org.apache.sling.samples.oauth_demo.YoutubeVideosModel">
<main>
- <h1>Search results</h1>
+ <h1>Youtube Videos</h1>
+ <form>
+ <label for="search">Search:</label>
+ <input type="text" id="search" name="search" value="${youtube.search}">
+ <button type="submit">Search</button>
+ </form>
<p>ERROR? ${youtube.response.error.message}</p>
<p>Got ${youtube.response.items.size} results of out total ${youtube.response.pageInfo.totalResults}</p>
<div data-sly-list.item="${youtube.response.items}"
(sling-samples) 08/15: fix: only render parts of the videos page when they have content
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-samples.git
commit ea450e70aa6cf4dfe273951296aac2be9442aa5f
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Tue Sep 10 17:51:20 2024 +0200
fix: only render parts of the videos page when they have content
---
.../oauth-demo/components/youtube-videos/show.html | 26 ++++++++++++----------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
index 451da12..622348b 100644
--- a/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
+++ b/oauth/ui.apps/src/main/content/jcr_root/apps/oauth-demo/components/youtube-videos/show.html
@@ -13,18 +13,20 @@
<input type="text" id="search" name="search" value="${youtube.search}">
<button type="submit">Search</button>
</form>
- <p>ERROR? ${youtube.response.error.message}</p>
- <p>Got ${youtube.response.items.size} results of out total ${youtube.response.pageInfo.totalResults}</p>
- <div data-sly-list.item="${youtube.response.items}"
- class="flex flex-row flex-wrap">
- <div class="basis-1/3 px-4">
- <a href="https://www.youtube.com/watch?v=${item.id.videoId}" target="_blank">
- <h2>${item.snippet.title}</h2>
- <img src="${item.snippet.thumbnails.medium.url}" alt="${item.snippet.title}">
- <p>${item.snippet.description}</p>
- </a>
- </div>
- </div>
+ <p data-sly-test="${youtube.response.error}">Error code ${youtube.response.error.code} : ${youtube.response.error.message}</p>
+ <sly data-sly-test="${youtube.response.items}">
+ <div data-sly-list.item="${youtube.response.items}"
+ class="flex flex-row flex-wrap">
+ <div class="basis-1/3 px-4">
+ <a href="https://www.youtube.com/watch?v=${item.id.videoId}" target="_blank">
+ <h2>${item.snippet.title}</h2>
+ <img src="${item.snippet.thumbnails.medium.url}" alt="${item.snippet.title}">
+ <p>${item.snippet.description}</p>
+ </a>
+ </div>
+ </div>
+ <p>Got ${youtube.response.items.size} results of out total ${youtube.response.pageInfo.totalResults}</p>
+ </sly>
</main>
</body>
</html>
\ No newline at end of file