Skip to content

Commit

Permalink
check auth when creating api
Browse files Browse the repository at this point in the history
  • Loading branch information
V-FEXrt committed Apr 24, 2024
1 parent 96107a1 commit f7d7332
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions share/wake/lib/system/remote_cache_api.wake
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,18 @@ export def makeRemoteCacheApi (config: String): Result RemoteCacheApi Error =
else failWithError "Remote cache config was set with non-integer port. Saw: {portStr}"

def auth = if authStr ==* "" then None else Some authStr
def api = RemoteCacheApi domain port auth

RemoteCacheApi domain port auth
| Pass
# TODO: check for compatable wake version

# If auth is not set we are done. Just return the api
require Some _ = auth
else Pass api

# Auth was set so it must be validated.
api
| rscApiCheckAuthorization
| rmapPass (\_ Pass api)

# rscApiPostStringBlob: Posts a named string as a blob to the remote server defined by *api*
# then returns the id associated to the blob. Requires authorization.
Expand Down

0 comments on commit f7d7332

Please sign in to comment.