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
96c48fba
Commit
96c48fba
authored
Jun 16, 2019
by
Sietse Ringers
Browse files
refactor: rename AttributeRequest field
parent
aaf64db6
Changes
1
Hide whitespace changes
Inline
Side-by-side
requests.go
View file @
96c48fba
...
...
@@ -173,9 +173,9 @@ type DisclosureChoice struct {
// An AttributeRequest asks for an instance of an attribute type, possibly requiring it to have
// a specified value, in a session request.
type
AttributeRequest
struct
{
Type
AttributeTypeIdentifier
`json:"type"`
Value
*
string
`json:"value,omitempty"`
Required
bool
`json:"
required
,omitempty"`
Type
AttributeTypeIdentifier
`json:"type"`
Value
*
string
`json:"value,omitempty"`
NotNull
bool
`json:"
notNull
,omitempty"`
}
var
(
...
...
@@ -249,7 +249,7 @@ func (ar *AttributeRequest) UnmarshalJSON(bts []byte) error {
}
func
(
ar
*
AttributeRequest
)
MarshalJSON
()
([]
byte
,
error
)
{
if
!
ar
.
Required
&&
ar
.
Value
==
nil
{
if
!
ar
.
NotNull
&&
ar
.
Value
==
nil
{
return
json
.
Marshal
(
ar
.
Type
)
}
return
json
.
Marshal
((
*
jsonAttributeRequest
)(
ar
))
...
...
@@ -258,7 +258,7 @@ func (ar *AttributeRequest) MarshalJSON() ([]byte, error) {
// Satisfy indicates whether the given attribute type and value satisfies this AttributeRequest.
func
(
ar
*
AttributeRequest
)
Satisfy
(
attr
AttributeTypeIdentifier
,
val
*
string
)
bool
{
return
ar
.
Type
==
attr
&&
(
!
ar
.
Required
||
val
!=
nil
)
&&
(
!
ar
.
NotNull
||
val
!=
nil
)
&&
(
ar
.
Value
==
nil
||
(
val
!=
nil
&&
*
ar
.
Value
==
*
val
))
}
...
...
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