Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
update mariadb config and fix defects - #155
Browse files Browse the repository at this point in the history
  • Loading branch information
dz-1 committed Feb 22, 2019
1 parent 066afaf commit 6347638
Show file tree
Hide file tree
Showing 26 changed files with 144 additions and 4 deletions.
10 changes: 10 additions & 0 deletions db/mariadb/config/oauth2-client/handler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ handlers:
- com.networknt.audit.AuditHandler@audit
- com.networknt.sanitizer.SanitizerHandler@sanitizer
- com.networknt.openapi.ValidatorHandler@validator
- com.networknt.cors.CorsHttpHandler@cors
# Customer business domain specific cross-cutting concerns handlers
# - com.example.validator.CustomizedValidator@custvalidator
# Framework endpoint handlers
Expand Down Expand Up @@ -73,8 +74,13 @@ chains:
- audit
- sanitizer
- validator
- cors

paths:
- path: '/oauth2/client'
method: 'options'
exec:
- cors
- path: '/oauth2/client'
method: 'post'
exec:
Expand All @@ -90,6 +96,10 @@ paths:
exec:
- default
- com.networknt.oauth.client.handler.Oauth2ClientGetHandler
- path: '/oauth2/client/{clientId}'
method: 'options'
exec:
- cors
- path: '/oauth2/client/{clientId}'
method: 'delete'
exec:
Expand Down
12 changes: 12 additions & 0 deletions db/mariadb/config/oauth2-client/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ servers:
- url: 'https://oauth2.networknt.com'
paths:
/oauth2/client:
options:
description: Return permissions
operationId: checkPermisson
responses:
'200':
description: Successful response
post:
description: Return a client object
operationId: createClient
Expand Down Expand Up @@ -79,6 +85,12 @@ paths:
- client_auth:
- oauth.client.r
'/oauth2/client/{clientId}':
options:
description: Return permissions
operationId: checkPermisson
responses:
'200':
description: Successful response
delete:
description: Delete a client by Id
operationId: deleteClient
Expand Down
Binary file modified db/mariadb/config/oauth2-client/server.keystore
Binary file not shown.
Binary file modified db/mariadb/config/oauth2-client/server.truststore
Binary file not shown.
Binary file modified db/mariadb/config/oauth2-code/server.keystore
Binary file not shown.
Binary file modified db/mariadb/config/oauth2-code/server.truststore
Binary file not shown.
6 changes: 6 additions & 0 deletions db/mariadb/config/oauth2-key/handler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ handlers:
- com.networknt.audit.AuditHandler@audit
- com.networknt.sanitizer.SanitizerHandler@sanitizer
- com.networknt.openapi.ValidatorHandler@validator
- com.networknt.cors.CorsHttpHandler@cors
# Customer business domain specific cross-cutting concerns handlers
# - com.example.validator.CustomizedValidator@custvalidator
# Framework endpoint handlers
Expand All @@ -64,8 +65,13 @@ chains:
- audit
- sanitizer
- validator
- cors

paths:
- path: '/oauth2/key/{keyId}'
method: 'options'
exec:
- cors
- path: '/oauth2/key/{keyId}'
method: 'get'
exec:
Expand Down
6 changes: 6 additions & 0 deletions db/mariadb/config/oauth2-key/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ servers:
- url: 'https://oauth2.networknt.com'
paths:
'/oauth2/key/{keyId}':
options:
description: Return permissions
operationId: checkPermisson
responses:
'200':
description: Successful response
get:
description: Get a key by Id
operationId: getKeyById
Expand Down
Binary file modified db/mariadb/config/oauth2-key/server.keystore
Binary file not shown.
Binary file modified db/mariadb/config/oauth2-key/server.truststore
Binary file not shown.
10 changes: 10 additions & 0 deletions db/mariadb/config/oauth2-service/handler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ handlers:
- com.networknt.audit.AuditHandler@audit
- com.networknt.sanitizer.SanitizerHandler@sanitizer
- com.networknt.openapi.ValidatorHandler@validator
- com.networknt.cors.CorsHttpHandler@cors
# Customer business domain specific cross-cutting concerns handlers
# - com.example.validator.CustomizedValidator@custvalidator
# Framework endpoint handlers
Expand Down Expand Up @@ -71,8 +72,13 @@ chains:
- audit
- sanitizer
- validator
- cors

paths:
- path: '/oauth2/service'
method: 'options'
exec:
- cors
- path: '/oauth2/service'
method: 'post'
exec:
Expand All @@ -88,6 +94,10 @@ paths:
exec:
- default
- com.networknt.oauth.service.handler.Oauth2ServiceGetHandler
- path: '/oauth2/service/{serviceId}'
method: 'options'
exec:
- cors
- path: '/oauth2/service/{serviceId}'
method: 'delete'
exec:
Expand Down
12 changes: 12 additions & 0 deletions db/mariadb/config/oauth2-service/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ servers:
- url: 'https://oauth2.networknt.com'
paths:
/oauth2/service:
options:
description: Return permissions
operationId: checkPermisson
responses:
'200':
description: Successful response
post:
description: Return a service object
operationId: createService
Expand Down Expand Up @@ -79,6 +85,12 @@ paths:
- service_auth:
- oauth.service.r
'/oauth2/service/{serviceId}':
options:
description: Return permissions
operationId: checkPermisson
responses:
'200':
description: Successful response
delete:
description: Delete a service by Id
operationId: deleteService
Expand Down
Binary file modified db/mariadb/config/oauth2-service/server.keystore
Binary file not shown.
Binary file modified db/mariadb/config/oauth2-service/server.truststore
Binary file not shown.
6 changes: 6 additions & 0 deletions db/mariadb/config/oauth2-token/handler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ handlers:
- com.networknt.audit.AuditHandler@audit
- com.networknt.sanitizer.SanitizerHandler@sanitizer
- com.networknt.openapi.ValidatorHandler@validator
- com.networknt.cors.CorsHttpHandler@cors
# Customer business domain specific cross-cutting concerns handlers
# - com.example.validator.CustomizedValidator@custvalidator
# Framework endpoint handlers
Expand All @@ -66,8 +67,13 @@ chains:
- audit
- sanitizer
- validator
- cors

paths:
- path: '/oauth2/token'
method: 'options'
exec:
- cors
- path: '/oauth2/token'
method: 'post'
exec:
Expand Down
6 changes: 6 additions & 0 deletions db/mariadb/config/oauth2-token/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ servers:
- url: 'https://oauth2.networknt.com'
paths:
/oauth2/token:
options:
description: Return permissions
operationId: checkPermisson
responses:
'200':
description: Successful response
post:
description: JSON object that contains access token
operationId: postToken
Expand Down
Binary file modified db/mariadb/config/oauth2-token/server.keystore
Binary file not shown.
Binary file modified db/mariadb/config/oauth2-token/server.truststore
Binary file not shown.
10 changes: 10 additions & 0 deletions db/mariadb/config/oauth2-user/handler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ handlers:
- com.networknt.audit.AuditHandler@audit
- com.networknt.sanitizer.SanitizerHandler@sanitizer
- com.networknt.openapi.ValidatorHandler@validator
- com.networknt.cors.CorsHttpHandler@cors
# Customer business domain specific cross-cutting concerns handlers
# - com.example.validator.CustomizedValidator@custvalidator
# Framework endpoint handlers
Expand Down Expand Up @@ -69,8 +70,13 @@ chains:
- audit
- sanitizer
- validator
- cors

paths:
- path: '/oauth2/user'
method: 'options'
exec:
- cors
- path: '/oauth2/user'
method: 'get'
exec:
Expand All @@ -86,6 +92,10 @@ paths:
exec:
- default
- com.networknt.oauth.user.handler.Oauth2UserPutHandler
- path: '/oauth2/user/{userId}'
method: 'options'
exec:
- cors
- path: '/oauth2/user/{userId}'
method: 'delete'
exec:
Expand Down
Binary file modified db/mariadb/config/oauth2-user/server.keystore
Binary file not shown.
Binary file modified db/mariadb/config/oauth2-user/server.truststore
Binary file not shown.
1 change: 1 addition & 0 deletions oauth2-console/.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ REACT_APP_PASSWORD_URL=https://localhost:6885/oauth2/password
REACT_APP_TOKEN_URL=https://localhost:6882/oauth2/token
REACT_APP_CODE_URL=https://localhost:6881/oauth2/code
REACT_APP_KEY_URL=https://localhost:6886/oauth2/key
REACT_APP_PROVIDERS_URL=https://localhost:6889/oauth2/provider

REACT_APP_DEFAULT_PAGE_ARG=?page=1

Expand Down
8 changes: 8 additions & 0 deletions oauth2-console/src/js/common/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,11 @@ export const Views = {
component: KeyView
}
};
/*
PROVIDER: {
name: "Providers",
path: "/providers",
dataType: "provider",
component: Provider
}
*/
36 changes: 32 additions & 4 deletions oauth2-console/src/js/components/keyView.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,30 @@ export class KeyView extends React.Component {
constructor(props){
super(props);

this.state = {
cert: ''
}
this.state={
loading: true,
showSpinner: false,
cert: '',
error: ''
};

this.axiosClient = Utils.createAxiosClient();

this.keyQueryUrl = process.env.REACT_APP_KEY_URL
}

resetStatus(){
this.setState({
loading: true,
showSpinner: false,
cert: '',
error: ''
});
}

requestCert(r){
this.resetStatus();

let authStr = 'Basic ' + btoa(r['client_id'] + ':' + r['client_secret']);
let config = {
headers: {
Expand All @@ -87,11 +101,15 @@ export class KeyView extends React.Component {
.then(response => {
const data = response.data;

this.setState({cert: data});
this.setState({cert: data, loading: false});
})
.catch(error => {
this.setState(Object.assign({}, this.state, {loading: false, showSpinner: false}));
this.handleError(error);
});

// only show the spinner when it takes too long to load
setTimeout(()=>this.setState(Object.assign({}, this.state, {showSpinner: true})), 500);
}

closeViewer(){
Expand All @@ -103,6 +121,16 @@ export class KeyView extends React.Component {
}

renderViewer(){
if (this.state.loading){
if (this.state.showSpinner){
return <div className='col-12'>
<div className='spinner-border text-primary m-5' role='status'>
<span className='sr-only'>Loading...</span>
</div>
</div>;
}
}

if (Utils.isEmpty(this.state.cert)){
return '';
}
Expand Down
9 changes: 9 additions & 0 deletions oauth2-console/src/js/components/webclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ export class WebClient extends React.Component {
error: ''});

callback && callback();
})
.catch(error=>{
this.setState({
activeId: '',
mode: WebClient.MODES.VIEW,
loading: false,
showSpinner: false});

this.handleError(error);
});

// only show the spinner when it takes too long to load
Expand Down
16 changes: 16 additions & 0 deletions oauth2-console/src/js/main/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,19 @@ export const User = () => (
hideFields={['password', 'passwordConfirm']}
/>
);

/* not in docker by default
export const Provider = ()=>(
<WebClient
dataType={Views.PROVIDER.dataType}
queryUrl={process.env.REACT_APP_PROVIDERS_URL}
postUrl={process.env.REACT_APP_PROVIDERS_URL}
putUrl={process.env.REACT_APP_PROVIDERS_URL}
getId={provider=>provider.providerId}
getName={provider=>provider.providerName}
getDeleteUrl={provider=>process.env.REACT_APP_PROVIDERS_URL + '/' + provider.providerId}
viewer={DataViewer}
editor={UserEditor}
/>
);
*/

0 comments on commit 6347638

Please sign in to comment.