Skip to content
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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jthoward64
Copy link

@jthoward64 jthoward64 commented Mar 7, 2023

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 to true. I did not add to the configuration page so the config would have to be set in the config.php file.

@@ -152,10 +152,17 @@ public function createToken()
throw new OCSForbiddenException();
}

$name = $this->request->getParam('session-name');

if ($name === '') {
Copy link
Member

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?

Copy link
Author

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';
Copy link
Member

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;
Copy link
Member

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)
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants