Skip to content

Commit 49c4cb5

Browse files
committed
formatting
1 parent 189ed07 commit 49c4cb5

2 files changed

Lines changed: 83 additions & 82 deletions

File tree

‎src/OidcClient.js‎

Lines changed: 48 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ import State from './State';
1414

1515
export default class OidcClient {
1616
constructor(settings, {
17-
stateStore = new WebStorageStateStore(),
17+
stateStore = new WebStorageStateStore(),
1818
ResponseValidatorCtor = ResponseValidator,
1919
MetadataServiceCtor = MetadataService
20-
} = {}){
21-
if (settings instanceof OidcClientSettings){
20+
} = {}) {
21+
if (settings instanceof OidcClientSettings) {
2222
this._settings = settings;
2323
}
2424
else {
@@ -28,139 +28,140 @@ export default class OidcClient {
2828
this._validator = new ResponseValidatorCtor(this._settings);
2929
this._metadataService = new MetadataServiceCtor(this._settings);
3030
}
31-
31+
3232
get settings() {
3333
return this._settings;
3434
}
35-
3635

3736
get metadataService() {
3837
return this._metadataService;
3938
}
4039

4140
createSigninRequest({
42-
response_type, scope, redirect_uri, data,
43-
prompt, display, max_age, ui_locales, id_token_hint, login_hint, acr_values}={},
41+
response_type, scope, redirect_uri, data,
42+
prompt, display, max_age, ui_locales, id_token_hint, login_hint, acr_values} = {},
4443
stateStore
4544
) {
4645
Log.info("OidcClient.createSigninRequest");
47-
46+
4847
stateStore = stateStore || this._stateStore;
49-
48+
5049
let client_id = this._settings.client_id;
5150
response_type = response_type || this._settings.response_type;
5251
scope = scope || this._settings.scope;
5352
redirect_uri = redirect_uri || this._settings.redirect_uri;
54-
53+
5554
// id_token_hint, login_hint aren't allowed on _settings
5655
prompt = prompt || this._settings.prompt;
5756
display = display || this._settings.display;
58-
max_age = max_age || this._settings.max_age ;
57+
max_age = max_age || this._settings.max_age;
5958
ui_locales = ui_locales || this._settings.ui_locales;
6059
acr_values = acr_values || this._settings.acr_values;
6160

6261
return this._metadataService.getAuthorizationEndpoint().then(url => {
6362
Log.info("Received authorization endpoint", url);
64-
65-
let request = new SigninRequest({url,
63+
64+
let request = new SigninRequest({
65+
url,
6666
client_id,
6767
redirect_uri,
6868
response_type,
6969
scope,
7070
data,
7171
prompt, display, max_age, ui_locales, id_token_hint, login_hint, acr_values
7272
});
73-
73+
7474
var state = request.state;
75-
76-
return stateStore.set(state.id, state.toStorageString()).then(()=>{
75+
76+
return stateStore.set(state.id, state.toStorageString()).then(() => {
7777
return request;
7878
});
7979
});
8080
}
81-
82-
processSigninResponse(url, stateStore){
81+
82+
processSigninResponse(url, stateStore) {
8383
Log.info("OidcClient.processSigninResponse");
84-
84+
8585
stateStore = stateStore || this._stateStore;
86-
86+
8787
var response = new SigninResponse(url);
8888
if (!response.state) {
8989
Log.error("No state in response");
9090
return Promise.reject(new Error("No state in response"));
9191
}
92-
92+
9393
var stateKey = response.state;
94-
94+
9595
return stateStore.remove(stateKey).then(storedStateString => {
96-
if (!storedStateString){
96+
if (!storedStateString) {
9797
Log.error("No matching state found in storage");
9898
throw new Error("No matching state found in storage");
9999
}
100-
100+
101101
let state = State.fromStorageString(storedStateString);
102-
102+
103103
Log.info("Received state from storage; validating response");
104104
return this._validator.validateSigninResponse(state, response);
105105
});
106106
}
107-
108-
createSignoutRequest({id_token_hint, data, post_logout_redirect_uri}={},
107+
108+
createSignoutRequest({id_token_hint, data, post_logout_redirect_uri} = {},
109109
stateStore
110-
){
110+
) {
111111
Log.info("OidcClient.createSignoutRequest");
112-
112+
113113
stateStore = stateStore || this._stateStore;
114-
114+
115115
post_logout_redirect_uri = post_logout_redirect_uri || this._settings.post_logout_redirect_uri;
116-
116+
117117
return this._metadataService.getEndSessionEndpoint().then(url => {
118118
Log.info("Received end session endpoint", url);
119-
120-
let request = new SignoutRequest({url,
119+
120+
let request = new SignoutRequest({
121+
url,
121122
id_token_hint,
122123
post_logout_redirect_uri,
123124
data
124125
});
125-
126+
126127
var state = request.state;
127128
stateStore.set(state.id, state.toStorageString());
128129

129130
return request;
130131
});
131132
}
132-
133-
processSignoutResponse(url, stateStore){
133+
134+
processSignoutResponse(url, stateStore) {
134135
Log.info("OidcClient.processSignoutResponse");
135-
136+
136137
stateStore = stateStore || this._stateStore;
137-
138+
138139
var response = new SignoutResponse(url);
139140
if (!response.state) {
140141
Log.error("No state in response");
141142
return Promise.reject(new Error("No state in response"));
142143
}
143-
144+
144145
var stateKey = response.state;
145-
146+
146147
return stateStore.remove(stateKey).then(storedStateString => {
147-
if (!storedStateString){
148+
if (!storedStateString) {
148149
Log.error("No matching state found in storage");
149150
throw new Error("No matching state found in storage");
150151
}
151-
152+
152153
let state = State.fromStorageString(storedStateString);
153-
154+
154155
Log.info("Received state from storage; validating response");
155156
return this._validator.validateSignoutResponse(state, response);
156157
});
157158
}
158-
159-
clearStaleState(stateStore){
159+
160+
clearStaleState(stateStore) {
160161
Log.info("OidcClient.clearStaleState");
161-
162+
162163
stateStore = stateStore || this._stateStore;
163-
164+
164165
return State.clearStaleState(stateStore, this.settings.staleStateAge);
165166
}
166167
}

0 commit comments

Comments
 (0)