Skip to content

Commit aa670fa

Browse files
authored
Updates for alpha.13 (#8026)
* 🐛 delete client if auth url has changed no issue * 🎨 update default auth config refs #7488
1 parent 6880199 commit aa670fa

File tree

5 files changed

+18
-6
lines changed

5 files changed

+18
-6
lines changed

core/server/auth/passport.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,18 @@ _private.updateClient = function updateClient(options) {
9191
});
9292
}
9393

94+
// CASE: auth url has changed, create client
95+
if (client.get('auth_uri') !== ghostOAuth2Strategy.url) {
96+
return models.Client.destroy({id: client.id})
97+
.then(function () {
98+
return _private.updateClient(options);
99+
});
100+
}
101+
94102
// CASE: nothing changed
95103
if (client.get('redirection_uri') === redirectUri &&
96104
client.get('name') === clientName &&
97105
client.get('description') === clientDescription &&
98-
client.get('auth_uri') === ghostOAuth2Strategy.url &&
99106
client.get('client_uri') === clientUri) {
100107
debug('Client did not change');
101108

core/server/config/defaults.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
"scheduling": {
1717
"active": "SchedulingDefault"
1818
},
19-
"auth": {
20-
"type": "ghost",
21-
"url": "http://devauth.ghost.org:8080"
22-
},
2319
"logging": {
2420
"level": "info",
2521
"rotation": {

core/server/config/env/config.development.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
},
88
"debug": false
99
},
10+
"auth": {
11+
"type": "ghost",
12+
"url": "http://devauth.ghost.org:8080"
13+
},
1014
"paths": {
1115
"contentPath": "content/"
1216
},

core/server/config/env/config.production.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
"database" : "ghost"
1010
}
1111
},
12+
"auth": {
13+
"type": "ghost",
14+
"url": "https://auth.ghost.org"
15+
},
1216
"paths": {
1317
"contentPath": "content/"
1418
},

core/test/integration/api/api_configuration_spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ describe('Configuration API', function () {
1919

2020
it('can read basic config and get all expected properties', function (done) {
2121
configUtils.set('auth:type', 'ghost');
22+
configUtils.set('auth:url', 'https://auth.ghost.com');
2223

2324
ConfigurationAPI.read().then(function (response) {
2425
var props;
@@ -44,7 +45,7 @@ describe('Configuration API', function () {
4445
props.publicAPI.should.eql(false);
4546
props.clientId.should.eql('ghost-admin');
4647
props.clientSecret.should.eql('not_available');
47-
props.ghostAuthUrl.should.eql('http://devauth.ghost.org:8080');
48+
props.ghostAuthUrl.should.eql('https://auth.ghost.com');
4849

4950
// value not available, because settings API was not called yet
5051
props.hasOwnProperty('blogTitle').should.eql(true);

0 commit comments

Comments
 (0)