mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Add client_secret_expires_at to Application, for forward-compatibility with expiring applications
This commit is contained in:
parent
2da2a1dae9
commit
9544ee54c8
3 changed files with 9 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class REST::CredentialApplicationSerializer < REST::ApplicationSerializer
|
||||
attributes :client_id, :client_secret
|
||||
attributes :client_id, :client_secret, :client_secret_expires_at
|
||||
|
||||
def client_id
|
||||
object.uid
|
||||
|
@ -10,4 +10,10 @@ class REST::CredentialApplicationSerializer < REST::ApplicationSerializer
|
|||
def client_secret
|
||||
object.secret
|
||||
end
|
||||
|
||||
# Added for future forwards compatibility when we may decide to expire OAuth
|
||||
# Applications. Set to zero means that the client_secret never expires.
|
||||
def client_secret_expires_at
|
||||
0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -39,6 +39,7 @@ describe 'Credentials' do
|
|||
|
||||
expect(body_as_json[:client_id]).to_not be_present
|
||||
expect(body_as_json[:client_secret]).to_not be_present
|
||||
expect(body_as_json[:client_secret_expires_at]).to_not be_present
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ RSpec.describe 'Apps' do
|
|||
id: app.id.to_s,
|
||||
client_id: app.uid,
|
||||
client_secret: app.secret,
|
||||
client_secret_expires_at: 0,
|
||||
name: client_name,
|
||||
website: website,
|
||||
scopes: ['read', 'write'],
|
||||
|
|
Loading…
Reference in a new issue