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
493648c9
Commit
493648c9
authored
Sep 10, 2017
by
Andreas Åkre Solberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Less logging
parent
d26bb495
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
31 deletions
+31
-31
src/components/HTTPFetchView.jsx
src/components/HTTPFetchView.jsx
+6
-6
src/components/HTTPResponseView.jsx
src/components/HTTPResponseView.jsx
+2
-2
src/components/HostnameInput.jsx
src/components/HostnameInput.jsx
+6
-6
src/components/ServerConfigInput.jsx
src/components/ServerConfigInput.jsx
+1
-1
src/components/TokenView.jsx
src/components/TokenView.jsx
+1
-1
src/utils/API.js
src/utils/API.js
+14
-14
src/utils/index.js
src/utils/index.js
+1
-1
No files found.
src/components/HTTPFetchView.jsx
View file @
493648c9
...
...
@@ -35,25 +35,25 @@ class Component extends PureComponent {
fetchUserinfo
()
{
let
endpoint
=
this
.
props
.
serverConfig
.
userinfo_endpoint
;
console
.
error
(
"
Get userinfo from
"
,
endpoint
)
//
console.error("Get userinfo from ", endpoint)
this
.
props
.
httpRequestStart
(
endpoint
)
}
fetchCustom
()
{
let
endpoint
=
this
.
state
.
customEndpoint
console
.
error
(
"
Get data from
"
,
endpoint
)
//
console.error("Get data from ", endpoint)
this
.
props
.
httpRequestStart
(
endpoint
)
}
preselect
(
key
,
event
)
{
console
.
log
(
"
Key
"
,
key
,
"
event
"
,
event
)
//
console.log("Key", key, "event", event)
this
.
setState
({
customEndpoint
:
key
})
}
renderDropdownButton
()
{
const
i
=
"
drpdwn
"
const
title
=
"
Load preset URL
"
console
.
log
(
"
PROPOS
"
,
this
.
props
)
//
console.log("PROPOS", this.props)
if
(
this
.
props
.
serverConfig
&&
this
.
props
.
serverConfig
.
authorization_endpoint
&&
this
.
props
.
serverConfig
.
authorization_endpoint
===
'
https://auth.dataporten.no/oauth/authorization
'
)
{
let
links
=
[]
if
(
this
.
props
.
serverConfig
.
userinfo_endpoint
)
{
...
...
@@ -76,7 +76,7 @@ class Component extends PureComponent {
url
:
"
https://
"
+
res
[
1
]
+
"
.dataporten-api.no/
"
,
title
:
"
Dataporten APIGK
"
+
res
[
1
]
})
console
.
log
(
res
)
//
console.log(res)
}
})
let
menuitems
=
links
.
map
((
link
)
=>
{
...
...
@@ -95,7 +95,7 @@ class Component extends PureComponent {
}
render
()
{
console
.
error
(
"
Component
"
,
this
.
props
)
//
console.error("Component", this.props)
if
(
!
this
.
props
.
token
)
{
return
null
...
...
src/components/HTTPResponseView.jsx
View file @
493648c9
...
...
@@ -31,7 +31,7 @@ class Component extends PureComponent {
fetchUserinfo
()
{
let
endpoint
=
this
.
props
.
serverConfig
.
userinfo_endpoint
;
console
.
error
(
"
Get userinfo from
"
,
endpoint
)
//
console.error("Get userinfo from ", endpoint)
this
.
props
.
httpRequestStart
(
endpoint
)
}
...
...
@@ -55,7 +55,7 @@ class Component extends PureComponent {
return
null
}
render
()
{
console
.
error
(
"
Component
"
,
this
.
props
)
//
console.error("Component", this.props)
if
(
!
this
.
props
.
http
)
{
return
(
...
...
src/components/HostnameInput.jsx
View file @
493648c9
...
...
@@ -16,25 +16,25 @@ class Component extends PureComponent {
}
discoveryStart
(
e
)
{
console
.
log
(
"
Setting hostname
"
,
this
.
state
.
hostname
)
console
.
log
(
this
.
props
)
//
console.log("Setting hostname", this.state.hostname)
//
console.log(this.props)
this
.
props
.
discoveryStart
(
this
.
state
.
hostname
)
}
updateHostfield
(
e
)
{
console
.
log
(
"
Updating hostname to
"
,
e
.
target
.
value
)
//
console.log("Updating hostname to ", e.target.value)
this
.
setState
({
hostname
:
e
.
target
.
value
})
}
handleAlertDismiss
()
{
console
.
error
(
"
TODO: Dismiss alert.
"
)
//
console.error("TODO: Dismiss alert.")
// this.setState({hostname: e.target.value})
}
getErrorMessage
()
{
if
(
this
.
props
.
serverError
)
{
console
.
log
(
typeof
this
.
props
.
serverError
)
console
.
error
(
this
.
props
.
serverError
)
//
console.log(typeof this.props.serverError)
//
console.error(this.props.serverError)
return
(
<
Alert
bsStyle
=
"danger"
onDismiss
=
{
this
.
handleAlertDismiss
}
>
<
h4
>
Error performing OAuth Discovery
</
h4
>
...
...
src/components/ServerConfigInput.jsx
View file @
493648c9
...
...
@@ -23,7 +23,7 @@ class Component extends PureComponent {
// search - Sets or returns the query portion of a URL
var
currentURL
=
window
.
location
.
protocol
+
'
//
'
+
window
.
location
.
hostname
+
(
window
.
location
.
port
?
'
:
'
+
window
.
location
.
port
:
''
)
+
'
/callback
'
console
.
log
(
"
currentURL
"
,
currentURL
)
//
console.log("currentURL", currentURL)
this
.
state
=
{
clientId
:
"
6233aedf-f08a-4112-9a1b-f33c3cd9b396
"
,
...
...
src/components/TokenView.jsx
View file @
493648c9
...
...
@@ -32,7 +32,7 @@ class Component extends PureComponent {
}
render
()
{
console
.
error
(
"
Component
"
,
this
.
props
)
//
console.error("Component", this.props)
if
(
!
this
.
props
.
token
)
{
return
(
...
...
src/utils/API.js
View file @
493648c9
...
...
@@ -16,7 +16,7 @@ const API = {
// config.headers["original-token"] = token.access_token
config
.
method
=
"
GET
"
config
.
mode
=
"
cors
"
console
.
log
(
"
About to fetch
"
,
config
)
//
console.log("About to fetch", config)
return
fetch
(
url
,
config
).
then
((
response
)
=>
{
if
(
response
.
ok
)
{
...
...
@@ -25,11 +25,11 @@ const API = {
throw
Error
(
response
.
statusText
)
})
.
then
((
data
)
=>
{
console
.
log
(
"
DATA
"
,
data
)
//
console.log("DATA", data)
dispatch
(
actions
.
discovery
.
completed
(
data
))
})
.
catch
((
err
)
=>
{
console
.
error
(
"
ERROR Fetching API Discovery
"
,
err
)
//
console.error("ERROR Fetching API Discovery", err)
dispatch
(
actions
.
discovery
.
completed
(
err
))
})
}
...
...
@@ -46,7 +46,7 @@ const API = {
config
.
headers
.
Authorization
=
'
Bearer
'
+
state
.
token
.
access_token
config
.
method
=
"
GET
"
config
.
mode
=
"
cors
"
console
.
log
(
"
About to fetch
"
,
config
)
//
console.log("About to fetch", config)
let
resp
=
null
...
...
@@ -70,7 +70,7 @@ const API = {
dispatch
(
actions
.
http
.
completed
(
r
))
})
.
catch
((
err
)
=>
{
console
.
error
(
"
ERROR Fetching API Discovery
"
,
err
)
//
console.error("ERROR Fetching API Discovery", err)
dispatch
(
actions
.
http
.
completed
(
err
))
})
}
...
...
@@ -78,10 +78,10 @@ const API = {
"
authenticate
"
:
function
(
config
)
{
return
dispatch
=>
{
console
.
error
(
"
About to save config
"
,
JSON
.
stringify
(
config
,
undefined
,
3
))
//
console.error("About to save config", JSON.stringify(config, undefined, 3))
dispatch
(
actions
.
serverConfig
.
save
(
config
))
console
.
error
(
"
About to authentication
"
,
JSON
.
stringify
(
config
,
undefined
,
3
))
//
console.error("About to authentication", JSON.stringify(config, undefined, 3))
const
jsoconfig
=
{
providerID
:
"
oauthPlay
"
,
client_id
:
config
.
clientId
,
...
...
@@ -91,7 +91,7 @@ const API = {
}
setTimeout
(()
=>
{
console
.
error
(
"
JSOCONFIG
"
,
JSON
.
stringify
(
jsoconfig
,
undefined
,
2
))
//
console.error("JSOCONFIG", JSON.stringify(jsoconfig, undefined, 2))
let
opts
=
{}
if
(
config
.
response_type
)
{
...
...
@@ -105,7 +105,7 @@ const API = {
appJSO
=
new
jso
(
jsoconfig
)
appJSO
.
getToken
((
token
)
=>
{
console
.
error
(
"
Got token, ayay
"
,
token
)
//
console.error("Got token, ayay", token)
dispatch
(
actions
.
tokens
.
save
(
token
))
},
opts
)
},
1000
)
...
...
@@ -123,7 +123,7 @@ const API = {
authorization
:
state
.
serverConfig
.
authorization_endpoint
// scopes: { request: ["userinfo"]}
}
console
.
error
(
"
About to logout with
"
,
jsoconfig
)
//
console.error("About to logout with ", jsoconfig)
appJSO
=
new
jso
(
jsoconfig
)
appJSO
.
wipeTokens
()
dispatch
(
actions
.
tokens
.
save
(
null
))
...
...
@@ -135,10 +135,10 @@ const API = {
var
state
=
getState
()
if
(
!
state
||
!
state
.
serverConfig
||
!
state
.
serverConfig
.
clientId
)
{
console
.
error
(
"
CANNOT DO CALLBACK BECAUSE CLIENDIT is missing...
"
,
state
)
//
console.error("CANNOT DO CALLBACK BECAUSE CLIENDIT is missing...", state)
return
}
console
.
error
(
"
. STATE STATE STATE
"
,
state
)
//
console.error(". STATE STATE STATE ", state)
const
jsoconfig
=
{
providerID
:
"
oauthPlay
"
,
client_id
:
state
.
serverConfig
.
clientId
,
...
...
@@ -146,10 +146,10 @@ const API = {
authorization
:
state
.
serverConfig
.
authorization_endpoint
// scopes: { request: ["userinfo"]}
}
console
.
error
(
"
. Initialising oauth callback
"
,
jsoconfig
)
//
console.error(". Initialising oauth callback", jsoconfig)
appJSO
=
new
jso
(
jsoconfig
)
appJSO
.
callback
(
undefined
,
(
token
)
=>
{
console
.
error
(
"
====) (===== Got token, ayay
"
,
token
)
//
console.error(" ====) (===== Got token, ayay", token)
dispatch
(
actions
.
tokens
.
save
(
token
))
})
}
...
...
src/utils/index.js
View file @
493648c9
...
...
@@ -71,7 +71,7 @@ export function processValues(defaults, uservalues) {
let
item
=
{
type
:
null
}
console
.
log
(
"
Processing key
"
,
key
)
//
console.log("Processing key", key)
if
(
defaults
&&
defaults
.
hasOwnProperty
(
key
))
{
item
.
type
=
getType
(
defaults
[
key
])
}
else
if
(
uservalues
&&
uservalues
.
hasOwnProperty
(
key
))
{
...
...
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