Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
a82b90ab
Unverified
Commit
a82b90ab
authored
3 years ago
by
reivilibre
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add type annotations to some of the configuration surrounding refresh tokens. (#11428)
parent
9cd13c5f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
changelog.d/11428.misc
+1
-0
1 addition, 0 deletions
changelog.d/11428.misc
synapse/config/registration.py
+5
-2
5 additions, 2 deletions
synapse/config/registration.py
synapse/handlers/register.py
+5
-0
5 additions, 0 deletions
synapse/handlers/register.py
with
11 additions
and
2 deletions
changelog.d/11428.misc
0 → 100644
+
1
−
0
View file @
a82b90ab
Add type annotations to some of the configuration surrounding refresh tokens.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
synapse/config/registration.py
+
5
−
2
View file @
a82b90ab
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
from
typing
import
Optional
from
synapse.api.constants
import
RoomCreationPreset
from
synapse.api.constants
import
RoomCreationPreset
from
synapse.config._base
import
Config
,
ConfigError
from
synapse.config._base
import
Config
,
ConfigError
...
@@ -123,12 +124,14 @@ class RegistrationConfig(Config):
...
@@ -123,12 +124,14 @@ class RegistrationConfig(Config):
refreshable_access_token_lifetime
=
self
.
parse_duration
(
refreshable_access_token_lifetime
=
self
.
parse_duration
(
refreshable_access_token_lifetime
refreshable_access_token_lifetime
)
)
self
.
refreshable_access_token_lifetime
=
refreshable_access_token_lifetime
self
.
refreshable_access_token_lifetime
:
Optional
[
int
]
=
refreshable_access_token_lifetime
refresh_token_lifetime
=
config
.
get
(
"
refresh_token_lifetime
"
)
refresh_token_lifetime
=
config
.
get
(
"
refresh_token_lifetime
"
)
if
refresh_token_lifetime
is
not
None
:
if
refresh_token_lifetime
is
not
None
:
refresh_token_lifetime
=
self
.
parse_duration
(
refresh_token_lifetime
)
refresh_token_lifetime
=
self
.
parse_duration
(
refresh_token_lifetime
)
self
.
refresh_token_lifetime
=
refresh_token_lifetime
self
.
refresh_token_lifetime
:
Optional
[
int
]
=
refresh_token_lifetime
# The fallback template used for authenticating using a registration token
# The fallback template used for authenticating using a registration token
self
.
registration_token_template
=
self
.
read_template
(
"
registration_token.html
"
)
self
.
registration_token_template
=
self
.
read_template
(
"
registration_token.html
"
)
...
...
This diff is collapsed.
Click to expand it.
synapse/handlers/register.py
+
5
−
0
View file @
a82b90ab
...
@@ -813,6 +813,11 @@ class RegistrationHandler:
...
@@ -813,6 +813,11 @@ class RegistrationHandler:
access_token
=
self
.
macaroon_gen
.
generate_guest_access_token
(
user_id
)
access_token
=
self
.
macaroon_gen
.
generate_guest_access_token
(
user_id
)
else
:
else
:
if
should_issue_refresh_token
:
if
should_issue_refresh_token
:
# A refreshable access token lifetime must be configured
# since we're told to issue a refresh token (the caller checks
# that this value is set before setting this flag).
assert
self
.
refreshable_access_token_lifetime
is
not
None
now_ms
=
self
.
clock
.
time_msec
()
now_ms
=
self
.
clock
.
time_msec
()
# Set the expiry time of the refreshable access token
# Set the expiry time of the refreshable access token
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment