Skip to content

Commit

Permalink
Updates for alpha.13 (#8026)
Browse files Browse the repository at this point in the history
* 🐛  delete client if auth url has changed

no issue

* 🎨  update default auth config

refs #7488
  • Loading branch information
kirrg001 committed Feb 18, 2017
1 parent 6880199 commit aa670fa
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
9 changes: 8 additions & 1 deletion core/server/auth/passport.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,18 @@ _private.updateClient = function updateClient(options) {
});
}

// CASE: auth url has changed, create client
if (client.get('auth_uri') !== ghostOAuth2Strategy.url) {
return models.Client.destroy({id: client.id})
.then(function () {
return _private.updateClient(options);
});
}

// CASE: nothing changed
if (client.get('redirection_uri') === redirectUri &&
client.get('name') === clientName &&
client.get('description') === clientDescription &&
client.get('auth_uri') === ghostOAuth2Strategy.url &&
client.get('client_uri') === clientUri) {
debug('Client did not change');

Expand Down
4 changes: 0 additions & 4 deletions core/server/config/defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
"scheduling": {
"active": "SchedulingDefault"
},
"auth": {
"type": "ghost",
"url": "http://devauth.ghost.org:8080"
},
"logging": {
"level": "info",
"rotation": {
Expand Down
4 changes: 4 additions & 0 deletions core/server/config/env/config.development.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
},
"debug": false
},
"auth": {
"type": "ghost",
"url": "http://devauth.ghost.org:8080"
},
"paths": {
"contentPath": "content/"
},
Expand Down
4 changes: 4 additions & 0 deletions core/server/config/env/config.production.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
"database" : "ghost"
}
},
"auth": {
"type": "ghost",
"url": "https://auth.ghost.org"
},
"paths": {
"contentPath": "content/"
},
Expand Down
3 changes: 2 additions & 1 deletion core/test/integration/api/api_configuration_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('Configuration API', function () {

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

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

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

0 comments on commit aa670fa

Please sign in to comment.