Add TokenEndpoint to backend.json

- The tokenEndpoint provided here will be used to check the authenticity
  of the token
This commit is contained in:
Peter Stuifzand 2018-05-16 21:21:00 +02:00
parent 5207e43430
commit 7199652e4a
4 changed files with 29 additions and 7 deletions

View File

@ -6,7 +6,8 @@ RUN go get github.com/pstuifzand/ekster/cmd/eksterd
# final stage
FROM alpine
RUN apk --no-cache add ca-certificates
WORKDIR /app
RUN ["mkdir", "-p", "/opt/micropub"]
WORKDIR /opt/micropub
EXPOSE 80
COPY --from=build-env /go/bin/eksterd /app/
ENTRYPOINT ./eksterd
ENTRYPOINT ["/app/eksterd"]

View File

@ -70,7 +70,10 @@ func (h *microsubHandler) cachedCheckAuthToken(header string, r *TokenResponse)
func (h *microsubHandler) checkAuthToken(header string, token *TokenResponse) bool {
log.Println("Checking auth token")
req, err := http.NewRequest("GET", "https://publog.stuifzandapp.com/authtoken", nil)
tokenEndpoint := h.Backend.(*memoryBackend).TokenEndpoint
req, err := http.NewRequest("GET", tokenEndpoint, nil)
if err != nil {
log.Println(err)
return false

View File

@ -35,10 +35,11 @@ import (
)
type memoryBackend struct {
Channels map[string]microsub.Channel
Feeds map[string][]microsub.Feed
NextUid int
Me string
Channels map[string]microsub.Channel
Feeds map[string][]microsub.Feed
NextUid int
Me string
TokenEndpoint string
ticker *time.Ticker
quit chan struct{}

17
docker-compose.yml Normal file
View File

@ -0,0 +1,17 @@
version: '2'
services:
redis:
image: "redis"
web:
image: "pstuifzand/eksterd:alpine"
working_dir: /opt/microsub
links:
- redis:redis
volumes:
- ./data:/opt/microsub
ports:
- 8090
environment:
- "FEEDBIN_USER="
- "FEEDBIN_PASS="