Change OAuth2 RS Origin from the CLI ()

* Enable changing the origin of an OAuth2 RS
This commit is contained in:
Matthew Wilks 2024-01-06 14:57:10 +10:00 committed by GitHub
parent 38f930c981
commit d56691f12d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 0 deletions
tools/cli/src

View file

@ -28,6 +28,7 @@ impl Oauth2Opt {
Oauth2Opt::CreateBasic { copt, .. } | Oauth2Opt::CreatePublic { copt, .. } => {
copt.debug
}
Oauth2Opt::SetOrigin { nopt, .. } => nopt.copt.debug,
}
}
@ -305,6 +306,25 @@ impl Oauth2Opt {
Err(e) => handle_client_error(e, nopt.copt.output_mode),
}
}
Oauth2Opt::SetOrigin { nopt, origin } => {
let client = nopt.copt.to_client(OpType::Write).await;
match client
.idm_oauth2_rs_update(
&nopt.name,
None,
None,
Some(origin),
None,
false,
false,
false,
)
.await
{
Ok(_) => println!("Success"),
Err(e) => handle_client_error(e, nopt.copt.output_mode),
}
}
}
}
}

View file

@ -905,6 +905,14 @@ pub enum Oauth2Opt {
#[clap(name = "prefer-spn-username")]
/// Use the 'spn' attribute instead of 'name' for the preferred_username
PreferSPNUsername(Named),
/// Set the origin of a client
#[clap(name = "set-origin")]
SetOrigin {
#[clap(flatten)]
nopt: Named,
#[clap(name = "origin")]
origin: String,
},
}
#[derive(Args, Debug)]