-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow setting a custom session name #46
base: main
Are you sure you want to change the base?
Conversation
@@ -152,10 +152,17 @@ public function createToken() | |||
throw new OCSForbiddenException(); | |||
} | |||
|
|||
$name = $this->request->getParam('session-name'); | |||
|
|||
if ($name === '') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the name null when the param isn't set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be, like I said I haven't tested this, I will take a closer look tomorrow. Just an idea of what I mean for now.
|
||
public function getAllowCustomName(): bool | ||
{ | ||
return $this->config->getAppValue('webapppassword', 'allowCustomName') == 'true'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please use something like token_name_suffix
instead of allowCustomName
.
if ($name === '') { | ||
$name = $targetOrigin.' '.$this->request->getHeader('USER_AGENT'); | ||
} else { | ||
'App Password: '.$name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line doesn't do anything. 😉
And can you please set the previous name by default.
return $this->config->getAppValue('webapppassword', 'allowCustomName') == 'true'; | ||
} | ||
|
||
public function setAllowCustomName($value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please use something like setTokenNameSuffix
.
An idea of what I mean in #45
This is a draft as I have not tested it, I don't see why it wouldn't work, but just to be sure.
Thid PR includes adding a way for a client to indicate how their should be named. This behavior is only enabled if the
allowCustomName
config is set totrue
. I did not add to the configuration page so the config would have to be set in theconfig.php
file.