forked from mainmatter/ember-simple-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfiguration.js
91 lines (77 loc) · 2.06 KB
/
configuration.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import Ember from 'ember';
const { getWithDefault } = Ember;
const DEFAULTS = {
baseURL: '',
authenticationRoute: 'login',
routeAfterAuthentication: 'index',
routeIfAlreadyAuthenticated: 'index'
};
/**
Ember Simple Auth's configuration object.
To change any of these values, set them on the application's environment
object, e.g.:
```js
// config/environment.js
ENV['ember-simple-auth'] = {
authenticationRoute: 'sign-in'
};
```
@class Configuration
@extends Object
@module ember-simple-auth/configuration
@public
*/
export default {
/**
The base URL of the application as configured in `config/environment.js`.
@property baseURL
@readOnly
@static
@type String
@default ''
@public
*/
baseURL: DEFAULTS.baseURL,
/**
The route to transition to for authentication. The
{{#crossLink "AuthenticatedRouteMixin"}}{{/crossLink}} will transition to
this route when a route that implements the mixin is accessed when the
route is not authenticated.
@property authenticationRoute
@readOnly
@static
@type String
@default 'login'
@public
*/
authenticationRoute: DEFAULTS.authenticationRoute,
/**
The route to transition to after successful authentication.
@property routeAfterAuthentication
@readOnly
@static
@type String
@default 'index'
@public
*/
routeAfterAuthentication: DEFAULTS.routeAfterAuthentication,
/**
The route to transition to if a route that implements the
{{#crossLink "UnauthenticatedRouteMixin"}}{{/crossLink}} is accessed when
the session is authenticated.
@property routeIfAlreadyAuthenticated
@readOnly
@static
@type String
@default 'index'
@public
*/
routeIfAlreadyAuthenticated: DEFAULTS.routeIfAlreadyAuthenticated,
load(config) {
for (let property in this) {
if (this.hasOwnProperty(property) && Ember.typeOf(this[property]) !== 'function') {
this[property] = getWithDefault(config, property, DEFAULTS[property]);
}
}
}
};