Skip to content

Commit ffafe61

Browse files
committed
Updating API documentation
1 parent 41f553f commit ffafe61

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

API_DOCUMENTATION.md

+62
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,68 @@ You can set the storage to localStorage, or implement a custom storage (see READ
116116

117117
### @Output() onModuleSetup: EventEmitter<any> = new EventEmitter<any>(true);
118118

119+
Example using:
120+
121+
122+
App.module: get your json settings:
123+
```
124+
configClient() {
125+
return this.http.get('/api/ClientAppSettings').map(res => {
126+
this.clientConfiguration = res.json();
127+
});
128+
}
129+
```
130+
App.module:
131+
Config the module, subscribe to the json get:
132+
```
133+
this.configClient().subscribe(config => {
134+
135+
console.log(this.clientConfiguration);
136+
const openIDImplicitFlowConfiguration = new OpenIDImplicitFlowConfiguration();
137+
openIDImplicitFlowConfiguration.stsServer = this.clientConfiguration.urlStsServer;
138+
139+
openIDImplicitFlowConfiguration.redirect_url = this.clientConfiguration.urlRedirect;
140+
// The Client MUST validate that the aud (audience) Claim contains its client_id value registered at the
141+
// Issuer identified by the iss (issuer) Claim as an audience.
142+
// The ID Token MUST be rejected if the ID Token does not list the Client as a valid audience,
143+
// or if it contains additional audiences not trusted by the Client.
144+
openIDImplicitFlowConfiguration.client_id = 'clientId';
145+
openIDImplicitFlowConfiguration.response_type = 'id_token token';
146+
openIDImplicitFlowConfiguration.scope = ' openid vmsscope profile email';
147+
openIDImplicitFlowConfiguration.post_logout_redirect_uri = this.clientConfiguration.urlRedirectPostLogout;
148+
openIDImplicitFlowConfiguration.start_checksession = false;
149+
openIDImplicitFlowConfiguration.silent_renew = true;
150+
openIDImplicitFlowConfiguration.startup_route = '/vms';
151+
// HTTP 403
152+
openIDImplicitFlowConfiguration.forbidden_route = '/forbidden';
153+
// HTTP 401
154+
openIDImplicitFlowConfiguration.unauthorized_route = '/unauthorized';
155+
openIDImplicitFlowConfiguration.log_console_warning_active = true;
156+
openIDImplicitFlowConfiguration.log_console_debug_active = true;
157+
// id_token C8: The iat Claim can be used to reject tokens that were issued too far away from the current time,
158+
// limiting the amount of time that nonces need to be stored to prevent attacks.The acceptable range is Client specific.
159+
openIDImplicitFlowConfiguration.max_id_token_iat_offset_allowed_in_seconds = 10;
160+
161+
this.oidcSecurityService.setupModule(openIDImplicitFlowConfiguration);
162+
});
163+
```
164+
165+
AppComponent, subscribe to the onModuleSetup event:
166+
```
167+
constructor(public oidcSecurityService: OidcSecurityService) {
168+
this.oidcSecurityService.onModuleSetup.subscribe(() => { this.onModuleSetup(); });
169+
}
170+
```
171+
172+
Handle the authorize callback using the event:
173+
```
174+
private onModuleSetup() {
175+
if (window.location.hash) {
176+
this.oidcSecurityService.authorizedCallback();
177+
}
178+
}
179+
```
180+
119181
This is required if you need to wait for a json configuration file to load.
120182

121183
### checkSessionChanged: boolean;

0 commit comments

Comments
 (0)