Move ptb auth file

This commit is contained in:
crschnick 2024-07-13 06:56:22 +00:00
parent ceee5d56b1
commit 73e61f48bd
3 changed files with 29 additions and 7 deletions

View file

@ -3535,7 +3535,7 @@ xor
|Name|Type|Required|Restrictions|Description| |Name|Type|Required|Restrictions|Description|
|---|---|---|---|---| |---|---|---|---|---|
|*anonymous*|[Local](#schemalocal)|false|none|Authentication method for local applications. Uses file system access as proof of authentication.| |*anonymous*|[Local](#schemalocal)|false|none|Authentication method for local applications. Uses file system access as proof of authentication.<br><br>You can find the authentication file at:<br>- %TEMP%\xpipe_auth on Windows<br>- $TMP/xpipe_auth on Linux<br>- $TMPDIR/xpipe_auth on macOS<br><br>For the PTB releases the file name is changed to xpipe_ptb_auth to prevent collisions.<br><br>As the temporary directory on Linux is global, the daemon might run as another user and your current user might not have permissions to access the auth file.|
<h2 id="tocS_ApiKey">ApiKey</h2> <h2 id="tocS_ApiKey">ApiKey</h2>
@ -3578,12 +3578,21 @@ API key authentication
Authentication method for local applications. Uses file system access as proof of authentication. Authentication method for local applications. Uses file system access as proof of authentication.
You can find the authentication file at:
- %TEMP%\xpipe_auth on Windows
- $TMP/xpipe_auth on Linux
- $TMPDIR/xpipe_auth on macOS
For the PTB releases the file name is changed to xpipe_ptb_auth to prevent collisions.
As the temporary directory on Linux is global, the daemon might run as another user and your current user might not have permissions to access the auth file.
<h3>Properties</h3> <h3>Properties</h3>
|Name|Type|Required|Restrictions|Description| |Name|Type|Required|Restrictions|Description|
|---|---|---|---|---| |---|---|---|---|---|
|type|string|true|none|none| |type|string|true|none|none|
|authFileContent|string|true|none|The contents of the local file $TEMP/xpipe_auth. This file is automatically generated when XPipe starts.| |authFileContent|string|true|none|The contents of the local file <temp dir>/xpipe_auth. This file is automatically generated when XPipe starts.|
<h2 id="tocS_ClientInformation">ClientInformation</h2> <h2 id="tocS_ClientInformation">ClientInformation</h2>

View file

@ -32,7 +32,7 @@ public class XPipeInstallation {
} }
public static Path getLocalBeaconAuthFile() { public static Path getLocalBeaconAuthFile() {
return Path.of(System.getProperty("java.io.tmpdir"), "xpipe_auth"); return Path.of(System.getProperty("java.io.tmpdir"), isStaging() ? "xpipe_ptb_auth" : "xpipe_auth");
} }
public static String createExternalAsyncLaunchCommand( public static String createExternalAsyncLaunchCommand(

View file

@ -55,11 +55,14 @@ paths:
$ref: '#/components/schemas/HandshakeRequest' $ref: '#/components/schemas/HandshakeRequest'
examples: examples:
standard: standard:
summary: Standard handshake summary: API key handshake
value: { "auth": { "type": "ApiKey", "key": "<API key>" }, "client": { "type": "Api", "name": "My client name" } } value: { "auth": { "type": "ApiKey", "key": "<API key>" }, "client": { "type": "Api", "name": "My client name" } }
local: local:
summary: Local application handshake summary: Local application handshake
value: { "auth": { "type": "Local", "authFileContent": "<Contents of the local file $TEMP/xpipe_auth>" }, "client": { "type": "Api", "name": "My client name" } } value: { "auth": { "type": "Local", "authFileContent": "<Contents of the local file <temp dir>/xpipe_auth>" }, "client": { "type": "Api", "name": "My client name" } }
local-ptb:
summary: Local PTB application handshake
value: { "auth": { "type": "Local", "authFileContent": "<Contents of the local file <temp dir>/xpipe_ptb_auth>" }, "client": { "type": "Api", "name": "My client name" } }
responses: responses:
'200': '200':
description: The handshake was successful. The returned token can be used for authentication in this session. The token is valid as long as XPipe is running. description: The handshake was successful. The returned token can be used for authentication in this session. The token is valid as long as XPipe is running.
@ -966,14 +969,24 @@ components:
- key - key
- type - type
Local: Local:
description: Authentication method for local applications. Uses file system access as proof of authentication. description: |
Authentication method for local applications. Uses file system access as proof of authentication.
You can find the authentication file at:
- %TEMP%\xpipe_auth on Windows
- $TMP/xpipe_auth on Linux
- $TMPDIR/xpipe_auth on macOS
For the PTB releases the file name is changed to xpipe_ptb_auth to prevent collisions.
As the temporary directory on Linux is global, the daemon might run as another user and your current user might not have permissions to access the auth file.
type: object type: object
properties: properties:
type: type:
type: string type: string
authFileContent: authFileContent:
type: string type: string
description: The contents of the local file $TEMP/xpipe_auth. This file is automatically generated when XPipe starts. description: The contents of the local file <temp dir>/xpipe_auth. This file is automatically generated when XPipe starts.
required: required:
- authFileContent - authFileContent
- type - type