Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
O
oauth-play
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ASM
oauth-play
Commits
3c6a3f2e
Commit
3c6a3f2e
authored
Sep 10, 2017
by
Andreas Åkre Solberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let ServerConfig update using actions global state.
parent
748bbc12
Pipeline
#3733
passed with stages
in 7 minutes and 41 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
22 deletions
+31
-22
src/components/ServerConfigInput.jsx
src/components/ServerConfigInput.jsx
+30
-21
src/containers/ServerConfigController.js
src/containers/ServerConfigController.js
+1
-1
No files found.
src/components/ServerConfigInput.jsx
View file @
3c6a3f2e
...
...
@@ -26,11 +26,11 @@ class Component extends PureComponent {
// console.log("currentURL", currentURL)
this
.
state
=
{
clientId
:
"
6233aedf-f08a-4112-9a1b-f33c3cd9b396
"
,
clientSecret
:
""
,
//
clientId: "6233aedf-f08a-4112-9a1b-f33c3cd9b396",
//
clientSecret: "",
redirectURL
:
currentURL
,
scopes
:
""
,
response_type
:
"
token
"
//
scopes: "",
//
response_type: "token"
}
}
...
...
@@ -47,9 +47,11 @@ class Component extends PureComponent {
updateFieldHandler
(
field
)
{
return
(
e
)
=>
{
this
.
setState
(
{
const
upd
=
{
[
field
]:
e
.
target
.
value
})
}
this
.
props
.
updateConfig
(
upd
)
// this.setState(upd)
}
}
...
...
@@ -59,26 +61,32 @@ class Component extends PureComponent {
// console.log("X This state", this.state)
let
authorizationEndpoint
=
''
if
(
this
.
state
.
authorizationEndpoint
)
{
authorizationEndpoint
=
this
.
state
.
authorizationEndpoint
}
else
if
(
this
.
props
.
serverConfig
)
{
if
(
this
.
props
.
serverConfig
)
{
authorizationEndpoint
=
this
.
props
.
serverConfig
.
authorization_endpoint
}
let
tokenEndpoint
=
''
if
(
this
.
state
.
tokenEndpoint
)
{
tokenEndpoint
=
this
.
state
.
tokenEndpoint
}
else
if
(
this
.
props
.
serverConfig
)
{
if
(
this
.
props
.
serverConfig
)
{
tokenEndpoint
=
this
.
props
.
serverConfig
.
token_endpoint
}
let
userinfoEndpoint
=
''
if
(
this
.
state
.
userinfoEndpoint
)
{
userinfoEndpoint
=
this
.
state
.
userinfoEndpoint
}
else
if
(
this
.
props
.
serverConfig
)
{
if
(
this
.
props
.
serverConfig
)
{
userinfoEndpoint
=
this
.
props
.
serverConfig
.
userinfo_endpoint
}
let
clientId
=
''
if
(
this
.
props
.
serverConfig
)
{
clientId
=
this
.
props
.
serverConfig
.
client_id
}
let
clientSecret
=
''
let
scopes
=
''
if
(
this
.
props
.
serverConfig
)
{
scopes
=
this
.
props
.
serverConfig
.
scopes
}
let
expanded
=
this
.
props
.
expanded
&&
!!
this
.
props
.
serverConfig
return
(
...
...
@@ -86,12 +94,12 @@ class Component extends PureComponent {
<
form
>
<
h4
>
OAuth Authorization endpoint
</
h4
>
<
FormGroup
>
<
FormControl
type
=
"text"
value
=
{
authorizationEndpoint
}
onChange
=
{
this
.
updateFieldHandler
.
bind
(
this
)(
"
authorization
E
ndpoint
"
)
}
/>
<
FormControl
type
=
"text"
value
=
{
authorizationEndpoint
}
onChange
=
{
this
.
updateFieldHandler
.
bind
(
this
)(
"
authorization
_e
ndpoint
"
)
}
/>
</
FormGroup
>
<
h4
>
OAuth Token endpoint
</
h4
>
<
FormGroup
>
<
FormControl
type
=
"text"
value
=
{
tokenEndpoint
}
onChange
=
{
this
.
updateFieldHandler
.
bind
(
this
)(
"
token
E
ndpoint
"
)
}
/>
<
FormControl
type
=
"text"
value
=
{
tokenEndpoint
}
onChange
=
{
this
.
updateFieldHandler
.
bind
(
this
)(
"
token
_e
ndpoint
"
)
}
/>
</
FormGroup
>
<
h4
>
Userinfo Endpoint
</
h4
>
...
...
@@ -101,17 +109,18 @@ class Component extends PureComponent {
<
h4
>
Client ID
</
h4
>
<
FormGroup
>
<
FormControl
type
=
"text"
bsSize
=
"large"
value
=
{
this
.
state
.
clientId
}
onChange
=
{
this
.
updateFieldHandler
.
bind
(
this
)(
"
clientI
d
"
)
}
/>
<
FormControl
type
=
"text"
bsSize
=
"large"
value
=
{
clientId
}
onChange
=
{
this
.
updateFieldHandler
.
bind
(
this
)(
"
client_i
d
"
)
}
/>
</
FormGroup
>
{
/*
<h4>Client secret</h4>
<FormGroup>
<
FormControl
type
=
"text"
bsSize
=
"large"
value
=
{
this
.
state
.
clientSecret
}
onChange
=
{
this
.
updateFieldHandler
.
bind
(
this
)(
"
clientS
ecret
"
)
}
/>
<FormControl type="text" bsSize="large" value={
clientSecret} onChange={this.updateFieldHandler.bind(this)("client_s
ecret")} />
</FormGroup>
*/
}
<
h4
>
Scopes
</
h4
>
<
FormGroup
>
<
FormControl
type
=
"text"
bsSize
=
"large"
value
=
{
this
.
state
.
scopes
}
onChange
=
{
this
.
updateFieldHandler
.
bind
(
this
)(
"
scopes
"
)
}
/>
<
FormControl
type
=
"text"
bsSize
=
"large"
value
=
{
scopes
}
onChange
=
{
this
.
updateFieldHandler
.
bind
(
this
)(
"
scopes
"
)
}
/>
</
FormGroup
>
<
FormGroup
controlId
=
"response_type"
>
...
...
src/containers/ServerConfigController.js
View file @
3c6a3f2e
...
...
@@ -11,7 +11,7 @@ const mapStateToProps = (state) => ({
const
mapDispatchToProps
=
{
authenticateStart
:
API
.
authenticate
,
logoutStart
:
API
.
logout
,
updateConfig
:
actions
.
discovery
.
completed
updateConfig
:
actions
.
serverConfig
.
save
}
const
Controller
=
connect
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment