Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nss-pam-webapi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
magicfelix
nss-pam-webapi
Commits
56728236
Verified
Commit
56728236
authored
3 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
[NSS] Allow JQ maps to be configured for endpoint subtypes and complete endpoints
parent
6d5f45f3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/oauth.rs
+17
-1
17 additions, 1 deletion
src/oauth.rs
with
17 additions
and
1 deletion
src/oauth.rs
+
17
−
1
View file @
56728236
...
...
@@ -151,8 +151,24 @@ fn get_data(conf: &Config, prefix: &str, endpoint: &str, param: String, token: &
.text
()
?
)
}
fn
get_jq_prog
(
conf
:
&
Config
,
prefix
:
&
str
,
endpoint
:
&
str
)
->
Option
<
String
>
{
match
get_optional
(
&
conf
,
&
full_key
(
vec!
[
prefix
,
"maps"
,
endpoint
]))
{
Some
(
v
)
=>
Some
(
v
),
None
=>
{
// Try falling back to more generic program
match
endpoint
.find
(
'.'
)
{
Some
(
i
)
=>
{
debug!
(
"JQ mapping program for {} not found; trying more generic definition"
,
endpoint
);
get_jq_prog
(
conf
,
prefix
,
&
endpoint
[
..
i
])
},
None
=>
None
}
}
}
}
pub
fn
get_data_jq
<
T
:
for
<
'de
>
Deserialize
<
'de
>>
(
conf
:
&
Config
,
prefix
:
&
str
,
endpoint
:
&
str
,
param
:
String
,
token
:
&
BasicTokenResponse
,
multi
:
bool
)
->
Result
<
T
,
Box
<
dyn
error
::
Error
>>
{
let
res
:
Option
<
String
>
=
get_
optional
(
&
conf
,
&
full_key
(
vec!
[
prefix
,
"maps"
,
endpoint
])
);
let
res
:
Option
<
String
>
=
get_
jq_prog
(
&
conf
,
prefix
,
endpoint
);
let
jq_code
=
match
res
{
Some
(
s
)
=>
{
debug!
(
"Found jq mapping program for endpoint {}"
,
endpoint
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment