Skip to content

Commit 464d14f

Browse files
committed
Consolidate some files
1 parent ad80e5b commit 464d14f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+574
-747
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ This server is intended as a reference implementation for testing purposes and e
1212

1313
This server is a work in progress.
1414
It will be updated as new specs are created.
15-
At the current time, the server supports only simple user registration and subscription management.
15+
At the current time, the server supports only simple user registration and subscriptionEntity management.

src/docs/index.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88

99
This server implements the https://openpodcastapi.org[Open Podcast API].
1010

11+
include::auth.adoc[]
1112
include::users.adoc[]
1213
include::subscriptions.adoc[]

src/docs/subscriptions.adoc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
:doctype: book
33
:sectlinks:
44

5-
The `subscriptions` endpoint exposes operations taken on subscriptions. A subscription represents two things:
5+
The `subscriptions` endpoint exposes operations taken on subscriptions. A subscriptionEntity represents two things:
66

77
1. A podcast feed
88
2. The relationship between a user and a podcast feed
@@ -18,7 +18,7 @@ POST /api/v1/users
1818
[[actions-subscriptions-create]]
1919
=== Create subscriptions
2020

21-
When a user adds a subscription to the system, a corresponding `subscription` object is fetched or created depending on whether a matching subscription is present. A link is then created between the user and the subscription.
21+
When a user adds a subscriptionEntity to the system, a corresponding `subscriptionEntity` object is fetched or created depending on whether a matching subscriptionEntity is present. A link is then created between the user and the subscriptionEntity.
2222

2323
operation::subscriptions-bulk-create-mixed[snippets='request-fields,curl-request,response-fields,http-response']
2424

@@ -47,16 +47,16 @@ operation::subscriptions-list[snippets='query-parameters,curl-request,response-f
4747

4848
operation::subscriptions-list-with-unsubscribed[snippets='curl-request,http-response']
4949

50-
[[actions-subscription-fetch]]
51-
=== Fetch a single subscription
50+
[[actions-subscriptionEntity-fetch]]
51+
=== Fetch a single subscriptionEntity
5252

53-
Returns the details of a single subscription for the authenticated user. Returns `404` if the user has no subscription entry for the feed in question.
53+
Returns the details of a single subscriptionEntity for the authenticated user. Returns `404` if the user has no subscriptionEntity entry for the feed in question.
5454

55-
operation::subscription-get[snippets='path-parameters,curl-request,response-fields,http-response']
55+
operation::subscriptionEntity-get[snippets='path-parameters,curl-request,response-fields,http-response']
5656

57-
[[actions-subscription-update]]
57+
[[actions-subscriptionEntity-update]]
5858
=== Unsubscribe from a feed
5959

60-
Unsubscribes the authenticated user from a feed. This action updates the user subscription record to mark the subscription as inactive. It does not delete the subscription record.
60+
Unsubscribes the authenticated user from a feed. This action updates the user subscriptionEntity record to mark the subscriptionEntity as inactive. It does not delete the subscriptionEntity record.
6161

62-
operation::subscription-unsubscribe[snippets='path-parameters,curl-request,response-fields,http-response']
62+
operation::subscriptionEntity-unsubscribe[snippets='path-parameters,curl-request,response-fields,http-response']

src/main/java/org/openpodcastapi/opa/auth/ApiAuthController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import lombok.extern.log4j.Log4j2;
77
import org.openpodcastapi.opa.config.JwtService;
88
import org.openpodcastapi.opa.security.TokenService;
9-
import org.openpodcastapi.opa.user.model.User;
10-
import org.openpodcastapi.opa.user.repository.UserRepository;
9+
import org.openpodcastapi.opa.user.User;
10+
import org.openpodcastapi.opa.user.UserRepository;
1111
import org.springframework.http.ResponseEntity;
1212
import org.springframework.security.authentication.AuthenticationManager;
1313
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;

src/main/java/org/openpodcastapi/opa/config/JwtAuthenticationFilter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
import lombok.RequiredArgsConstructor;
1313
import lombok.extern.log4j.Log4j2;
1414
import org.openpodcastapi.opa.service.CustomUserDetails;
15-
import org.openpodcastapi.opa.user.model.User;
16-
import org.openpodcastapi.opa.user.repository.UserRepository;
15+
import org.openpodcastapi.opa.user.User;
16+
import org.openpodcastapi.opa.user.UserRepository;
1717
import org.springframework.beans.factory.annotation.Value;
1818
import org.springframework.http.HttpHeaders;
1919
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -69,7 +69,7 @@ protected void doFilterInternal(HttpServletRequest req, @Nonnull HttpServletResp
6969
throws ServletException, IOException {
7070

7171
// Don't apply the check on the auth endpoints
72-
if (req.getRequestURI().startsWith("/api/auth/")) {
72+
if (req.getRequestURI().startsWith("/api/auth/") || req.getRequestURI().startsWith("/docs")) {
7373
chain.doFilter(req, res);
7474
return;
7575
}

src/main/java/org/openpodcastapi/opa/config/SecurityConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http) throws
3232
.sessionManagement(sm -> sm
3333
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) // Stateless session
3434
.authorizeHttpRequests(auth -> auth
35-
.requestMatchers("/", "/login", "/logout-confirm", "/register", "/docs", "/css/**", "/js/**", "/images/**", "/favicon.ico", "/api/auth/login", "/api/auth/refresh").permitAll()
35+
.requestMatchers("/", "/login", "/logout-confirm", "/register", "/docs**", "/css/**", "/js/**", "/images/**", "/favicon.ico", "/api/auth/**").permitAll()
3636
.requestMatchers("/api/v1/**").authenticated()
3737
.anyRequest().authenticated())
3838
.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class)

src/main/java/org/openpodcastapi/opa/config/TemplateConfig.java

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/main/java/org/openpodcastapi/opa/config/WebConfig.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.openpodcastapi.opa.config;
22

3+
import nz.net.ultraq.thymeleaf.layoutdialect.LayoutDialect;
4+
import org.springframework.context.annotation.Bean;
35
import org.springframework.context.annotation.Configuration;
46
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
57
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@@ -20,4 +22,9 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) {
2022
.addResourceHandler("/docs/**")
2123
.addResourceLocations("classpath:/docs/");
2224
}
25+
26+
@Bean
27+
public LayoutDialect layoutDialect() {
28+
return new LayoutDialect();
29+
}
2330
}

src/main/java/org/openpodcastapi/opa/helpers/UUIDHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static UUID getFeedUUID(String feedUrl) {
5252
return generator.generate(sanitizedFeedUrl);
5353
}
5454

55-
/// Validates that a supplied subscription UUID has been calculated properly
55+
/// Validates that a supplied subscriptionEntity UUID has been calculated properly
5656
///
5757
/// @param feedUrl the URL of the podcast feed
5858
/// @param suppliedUUID the UUID to validate

src/main/java/org/openpodcastapi/opa/security/RefreshToken.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import jakarta.persistence.*;
44
import lombok.*;
5-
import org.openpodcastapi.opa.user.model.User;
5+
import org.openpodcastapi.opa.user.User;
66

77
import java.time.Instant;
88

0 commit comments

Comments
 (0)