Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
IRMA
Github mirrors
irmago
Commits
2a599d69
Unverified
Commit
2a599d69
authored
Oct 24, 2019
by
Tomas
Committed by
GitHub
Oct 24, 2019
Browse files
Merge pull request #65 from privacybydesign/client-return-url
Client return url
parents
d6e62a7b
33fe0e30
Changes
6
Hide whitespace changes
Inline
Side-by-side
internal/sessiontest/server_test.go
View file @
2a599d69
...
@@ -99,7 +99,7 @@ var JwtServerConfiguration = &requestorserver.Configuration{
...
@@ -99,7 +99,7 @@ var JwtServerConfiguration = &requestorserver.Configuration{
},
},
Port
:
48682
,
Port
:
48682
,
DisableRequestorAuthentication
:
false
,
DisableRequestorAuthentication
:
false
,
MaxRequestAge
:
3
,
MaxRequestAge
:
3
,
Permissions
:
requestorserver
.
Permissions
{
Permissions
:
requestorserver
.
Permissions
{
Disclosing
:
[]
string
{
"*"
},
Disclosing
:
[]
string
{
"*"
},
Signing
:
[]
string
{
"*"
},
Signing
:
[]
string
{
"*"
},
...
@@ -122,7 +122,7 @@ var JwtServerConfiguration = &requestorserver.Configuration{
...
@@ -122,7 +122,7 @@ var JwtServerConfiguration = &requestorserver.Configuration{
StaticSessions
:
map
[
string
]
interface
{}{
StaticSessions
:
map
[
string
]
interface
{}{
"staticsession"
:
irma
.
ServiceProviderRequest
{
"staticsession"
:
irma
.
ServiceProviderRequest
{
RequestorBaseRequest
:
irma
.
RequestorBaseRequest
{
RequestorBaseRequest
:
irma
.
RequestorBaseRequest
{
CallbackU
rl
:
"http://localhost:48685"
,
CallbackU
RL
:
"http://localhost:48685"
,
},
},
Request
:
&
irma
.
DisclosureRequest
{
Request
:
&
irma
.
DisclosureRequest
{
BaseRequest
:
irma
.
BaseRequest
{
LDContext
:
irma
.
LDContextDisclosureRequest
},
BaseRequest
:
irma
.
BaseRequest
{
LDContext
:
irma
.
LDContextDisclosureRequest
},
...
...
irmaclient/handlers.go
View file @
2a599d69
...
@@ -83,3 +83,6 @@ func (h *keyshareEnrollmentHandler) KeyshareEnrollmentMissing(manager irma.Schem
...
@@ -83,3 +83,6 @@ func (h *keyshareEnrollmentHandler) KeyshareEnrollmentMissing(manager irma.Schem
func
(
h
*
keyshareEnrollmentHandler
)
UnsatisfiableRequest
(
request
irma
.
SessionRequest
,
ServerName
irma
.
TranslatedString
,
missing
MissingAttributes
)
{
func
(
h
*
keyshareEnrollmentHandler
)
UnsatisfiableRequest
(
request
irma
.
SessionRequest
,
ServerName
irma
.
TranslatedString
,
missing
MissingAttributes
)
{
h
.
fail
(
errors
.
New
(
"Keyshare enrollment failed: unsatisfiable"
))
h
.
fail
(
errors
.
New
(
"Keyshare enrollment failed: unsatisfiable"
))
}
}
func
(
h
*
keyshareEnrollmentHandler
)
ClientReturnURLSet
(
clientReturnURL
string
)
{
h
.
fail
(
errors
.
New
(
"Keyshare enrollment session unexpectedly found an external return url"
))
}
irmaclient/session.go
View file @
2a599d69
...
@@ -30,6 +30,7 @@ type PinHandler func(proceed bool, pin string)
...
@@ -30,6 +30,7 @@ type PinHandler func(proceed bool, pin string)
// A Handler contains callbacks for communication to the user.
// A Handler contains callbacks for communication to the user.
type
Handler
interface
{
type
Handler
interface
{
StatusUpdate
(
action
irma
.
Action
,
status
irma
.
Status
)
StatusUpdate
(
action
irma
.
Action
,
status
irma
.
Status
)
ClientReturnURLSet
(
clientReturnURL
string
)
Success
(
result
string
)
Success
(
result
string
)
Cancelled
()
Cancelled
()
Failure
(
err
*
irma
.
SessionError
)
Failure
(
err
*
irma
.
SessionError
)
...
@@ -309,6 +310,12 @@ func (session *session) processSessionInfo() {
...
@@ -309,6 +310,12 @@ func (session *session) processSessionInfo() {
go
session
.
doSession
(
proceed
)
go
session
.
doSession
(
proceed
)
})
})
session
.
Handler
.
StatusUpdate
(
session
.
Action
,
irma
.
StatusConnected
)
session
.
Handler
.
StatusUpdate
(
session
.
Action
,
irma
.
StatusConnected
)
// Handle ClientReturnURL if one is found in the session request
if
session
.
request
.
Base
()
.
ClientReturnURL
!=
""
{
session
.
Handler
.
ClientReturnURLSet
(
session
.
request
.
Base
()
.
ClientReturnURL
)
}
switch
session
.
Action
{
switch
session
.
Action
{
case
irma
.
ActionDisclosing
:
case
irma
.
ActionDisclosing
:
session
.
Handler
.
RequestVerificationPermission
(
session
.
Handler
.
RequestVerificationPermission
(
...
...
requests.go
View file @
2a599d69
...
@@ -34,6 +34,8 @@ type BaseRequest struct {
...
@@ -34,6 +34,8 @@ type BaseRequest struct {
legacy
bool
// Whether or not this was deserialized from a legacy (pre-condiscon) request
legacy
bool
// Whether or not this was deserialized from a legacy (pre-condiscon) request
Type
Action
`json:"type,omitempty"`
// Session type, only used in legacy code
Type
Action
`json:"type,omitempty"`
// Session type, only used in legacy code
ClientReturnURL
string
`json:"clientReturnUrl,omitempty"`
// URL to proceed to when IRMA session is completed
}
}
// An AttributeCon is only satisfied if all of its containing attribute requests are satisfied.
// An AttributeCon is only satisfied if all of its containing attribute requests are satisfied.
...
@@ -108,7 +110,7 @@ type ServerJwt struct {
...
@@ -108,7 +110,7 @@ type ServerJwt struct {
type
RequestorBaseRequest
struct
{
type
RequestorBaseRequest
struct
{
ResultJwtValidity
int
`json:"validity,omitempty"`
// Validity of session result JWT in seconds
ResultJwtValidity
int
`json:"validity,omitempty"`
// Validity of session result JWT in seconds
ClientTimeout
int
`json:"timeout,omitempty"`
// Wait this many seconds for the IRMA app to connect before the session times out
ClientTimeout
int
`json:"timeout,omitempty"`
// Wait this many seconds for the IRMA app to connect before the session times out
CallbackU
rl
string
`json:"callbackUrl,omitempty"`
// URL to post session result to
CallbackU
RL
string
`json:"callbackUrl,omitempty"`
// URL to post session result to
}
}
// RequestorRequest is the message with which requestors start an IRMA session. It contains a
// RequestorRequest is the message with which requestors start an IRMA session. It contains a
...
...
server/requestorserver/conf.go
View file @
2a599d69
...
@@ -271,7 +271,7 @@ func (conf *Configuration) initialize() error {
...
@@ -271,7 +271,7 @@ func (conf *Configuration) initialize() error {
if
action
!=
irma
.
ActionDisclosing
&&
action
!=
irma
.
ActionSigning
{
if
action
!=
irma
.
ActionDisclosing
&&
action
!=
irma
.
ActionSigning
{
return
errors
.
Errorf
(
"static session %s must be either a disclosing or signing session"
,
name
)
return
errors
.
Errorf
(
"static session %s must be either a disclosing or signing session"
,
name
)
}
}
if
rrequest
.
Base
()
.
CallbackU
rl
==
""
{
if
rrequest
.
Base
()
.
CallbackU
RL
==
""
{
return
errors
.
Errorf
(
"static session %s has no callback URL"
,
name
)
return
errors
.
Errorf
(
"static session %s has no callback URL"
,
name
)
}
}
conf
.
staticSessions
[
name
]
=
rrequest
conf
.
staticSessions
[
name
]
=
rrequest
...
...
server/requestorserver/server.go
View file @
2a599d69
...
@@ -340,7 +340,7 @@ func (s *Server) handleCreate(w http.ResponseWriter, r *http.Request) {
...
@@ -340,7 +340,7 @@ func (s *Server) handleCreate(w http.ResponseWriter, r *http.Request) {
return
return
}
}
}
}
if
rrequest
.
Base
()
.
CallbackU
rl
!=
""
&&
s
.
conf
.
jwtPrivateKey
==
nil
{
if
rrequest
.
Base
()
.
CallbackU
RL
!=
""
&&
s
.
conf
.
jwtPrivateKey
==
nil
{
s
.
conf
.
Logger
.
WithFields
(
logrus
.
Fields
{
"requestor"
:
requestor
})
.
Warn
(
"Requestor provided callbackUrl but no JWT private key is installed"
)
s
.
conf
.
Logger
.
WithFields
(
logrus
.
Fields
{
"requestor"
:
requestor
})
.
Warn
(
"Requestor provided callbackUrl but no JWT private key is installed"
)
server
.
WriteError
(
w
,
server
.
ErrorUnsupported
,
""
)
server
.
WriteError
(
w
,
server
.
ErrorUnsupported
,
""
)
return
return
...
@@ -547,7 +547,7 @@ func (s *Server) resultJwt(sessionresult *server.SessionResult) (string, error)
...
@@ -547,7 +547,7 @@ func (s *Server) resultJwt(sessionresult *server.SessionResult) (string, error)
}
}
func
(
s
*
Server
)
doResultCallback
(
result
*
server
.
SessionResult
)
{
func
(
s
*
Server
)
doResultCallback
(
result
*
server
.
SessionResult
)
{
callbackUrl
:=
s
.
irmaserv
.
GetRequest
(
result
.
Token
)
.
Base
()
.
CallbackU
rl
callbackUrl
:=
s
.
irmaserv
.
GetRequest
(
result
.
Token
)
.
Base
()
.
CallbackU
RL
if
callbackUrl
==
""
{
if
callbackUrl
==
""
{
return
return
}
}
...
...
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