@@ -98,6 +98,11 @@ pub struct Install {
9898 #[ clap( long = PLUGIN_OVERRIDE_COMPATIBILITY_CHECK_FLAG , takes_value = false ) ]
9999 pub override_compatibility_check : bool ,
100100
101+ /// Provide the value for the authorization header to be able to install a plugin from a private repository.
102+ /// (e.g) --auth-header-value "Bearer <token>"
103+ #[ clap( long = "auth-header-value" , requires = PLUGIN_REMOTE_PLUGIN_MANIFEST_OPT ) ]
104+ pub auth_header_value : Option < String > ,
105+
101106 /// Specific version of a plugin to be install from the centralized plugins
102107 /// repository.
103108 #[ clap(
@@ -126,6 +131,7 @@ impl Install {
126131 & manifest_location,
127132 self . override_compatibility_check ,
128133 SPIN_VERSION ,
134+ & self . auth_header_value ,
129135 )
130136 . await ?;
131137 try_install (
@@ -135,6 +141,7 @@ impl Install {
135141 self . override_compatibility_check ,
136142 downgrade,
137143 & manifest_location,
144+ & self . auth_header_value ,
138145 )
139146 . await ?;
140147 Ok ( ( ) )
@@ -207,6 +214,11 @@ pub struct Upgrade {
207214 #[ clap( short = 'y' , long = "yes" , takes_value = false ) ]
208215 pub yes_to_all : bool ,
209216
217+ /// Provide the value for the authorization header to be able to install a plugin from a private repository.
218+ /// (e.g) --auth-header-value "Bearer <token>"
219+ #[ clap( long = "auth-header-value" , requires = PLUGIN_REMOTE_PLUGIN_MANIFEST_OPT ) ]
220+ pub auth_header_value : Option < String > ,
221+
210222 /// Overrides a failed compatibility check of the plugin with the current version of Spin.
211223 #[ clap( long = PLUGIN_OVERRIDE_COMPATIBILITY_CHECK_FLAG , takes_value = false ) ]
212224 pub override_compatibility_check : bool ,
@@ -288,7 +300,12 @@ impl Upgrade {
288300
289301 // Attempt to get the manifest to check eligibility to upgrade
290302 if let Ok ( manifest) = manager
291- . get_manifest ( & manifest_location, false , SPIN_VERSION )
303+ . get_manifest (
304+ & manifest_location,
305+ false ,
306+ SPIN_VERSION ,
307+ & self . auth_header_value ,
308+ )
292309 . await
293310 {
294311 // Check if upgraded candidates have a newer version and if are compatible
@@ -341,7 +358,16 @@ impl Upgrade {
341358 None ,
342359 ) ) ;
343360
344- try_install ( & manifest, & manager, true , false , false , & manifest_location) . await ?;
361+ try_install (
362+ & manifest,
363+ & manager,
364+ true ,
365+ false ,
366+ false ,
367+ & manifest_location,
368+ & self . auth_header_value ,
369+ )
370+ . await ?;
345371 }
346372
347373 Ok ( ( ) )
@@ -365,6 +391,7 @@ impl Upgrade {
365391 & manifest_location,
366392 self . override_compatibility_check ,
367393 SPIN_VERSION ,
394+ & self . auth_header_value ,
368395 )
369396 . await
370397 {
@@ -382,6 +409,7 @@ impl Upgrade {
382409 self . override_compatibility_check ,
383410 self . downgrade ,
384411 & manifest_location,
412+ & self . auth_header_value ,
385413 )
386414 . await ?;
387415 }
@@ -405,6 +433,7 @@ impl Upgrade {
405433 & manifest_location,
406434 self . override_compatibility_check ,
407435 SPIN_VERSION ,
436+ & self . auth_header_value ,
408437 )
409438 . await ?;
410439 try_install (
@@ -414,6 +443,7 @@ impl Upgrade {
414443 self . override_compatibility_check ,
415444 self . downgrade ,
416445 & manifest_location,
446+ & self . auth_header_value ,
417447 )
418448 . await ?;
419449 Ok ( ( ) )
@@ -434,6 +464,7 @@ impl Show {
434464 & ManifestLocation :: PluginsRepository ( PluginLookup :: new ( & self . name , None ) ) ,
435465 false ,
436466 SPIN_VERSION ,
467+ & None ,
437468 )
438469 . await ?;
439470
@@ -789,6 +820,7 @@ async fn try_install(
789820 override_compatibility_check : bool ,
790821 downgrade : bool ,
791822 source : & ManifestLocation ,
823+ auth_header_value : & Option < String > ,
792824) -> Result < bool > {
793825 let install_action = manager. check_manifest (
794826 manifest,
@@ -804,7 +836,9 @@ async fn try_install(
804836
805837 let package = manager:: get_package ( manifest) ?;
806838 if continue_to_install ( manifest, package, yes_to_all) ? {
807- let installed = manager. install ( manifest, package, source) . await ?;
839+ let installed = manager
840+ . install ( manifest, package, source, auth_header_value)
841+ . await ?;
808842 println ! ( "Plugin '{installed}' was installed successfully!" ) ;
809843
810844 if let Some ( description) = manifest. description ( ) {
0 commit comments