pub struct FeishuAuthPlugin {
app_id: String,
app_secret: String,
auth_redirect_uri: String,
code_header: String,
code_query: String,
token_url: String,
userinfo_url: String,
set_userinfo_header: bool,
timeout: Duration,
ssl_verify: bool,
resources: Arc<PluginResources>,
}Expand description
Authenticates requests by exchanging a Feishu authorization code for a user access token, then resolving that token to a Feishu user.
Fields§
§app_id: String§app_secret: String§auth_redirect_uri: String§code_header: String§code_query: String§token_url: String§userinfo_url: String§set_userinfo_header: bool§timeout: Duration§ssl_verify: bool§resources: Arc<PluginResources>Implementations§
Source§impl FeishuAuthPlugin
impl FeishuAuthPlugin
Sourcepub fn from_config(
config: &HashMap<String, Value>,
resources: &Arc<PluginResources>,
) -> Result<Self, String>
pub fn from_config( config: &HashMap<String, Value>, resources: &Arc<PluginResources>, ) -> Result<Self, String>
Builds the plugin from node config.
Accepted keys:
app_id(string, required): Feishu application id.app_secret(string, required): Feishu application secret.auth_redirect_uri(string, required): theredirect_uriregistered with Feishu; sent in theauthorization_codetoken-exchange body and must match the one used to obtain the code.code_header(string, default"X-Feishu-Code"): header the code is read from first (matched case-insensitively).code_query(string, default"code"): query parameter fallback.access_token_url(string, default Feishu’soauth/token).userinfo_url(string, default Feishu’sauthen/v1/user_info).set_userinfo_header(bool, defaulttrue): base64-encode the resolved userinfo into theX-Userinforequest header.timeout(integer ms, default6000).ssl_verify(bool, defaulttrue).
Session-only APISIX keys (secret, secret_fallbacks, redirect_uri,
cookie_expires_in) are not accepted — see the module docs.
type: feishu-auth
config:
app_id: ${FEISHU_APP_ID}
app_secret: ${FEISHU_APP_SECRET}
auth_redirect_uri: https://app.example.com/callbackfn extract_code(&self, ctx: &Context) -> Option<String>
Sourceasync fn fetch_access_token(&self, code: &str) -> Result<String, FeishuError>
async fn fetch_access_token(&self, code: &str) -> Result<String, FeishuError>
Exchanges code for a Feishu user access token.
Sourcefn token_request_body(&self, code: &str) -> Value
fn token_request_body(&self, code: &str) -> Value
Builds the authorization_code token-exchange body.
Sourceasync fn fetch_userinfo(&self, access_token: &str) -> Result<Value, FeishuError>
async fn fetch_userinfo(&self, access_token: &str) -> Result<Value, FeishuError>
Resolves the access token to Feishu userinfo.
fn reject( ctx: Context, message: &str, ) -> Result<PluginOutput, PluginExecutionError>
Trait Implementations§
Source§impl Plugin for FeishuAuthPlugin
impl Plugin for FeishuAuthPlugin
Source§fn plugin_type(&self) -> &str
fn plugin_type(&self) -> &str
Unique identifier for the plugin type (e.g., “proxy-rewrite”, “upstream”).
Source§fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: Context,
_named_inputs: &'life1 HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<PluginOutput, PluginExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: Context,
_named_inputs: &'life1 HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<PluginOutput, PluginExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Executes the plugin logic against the request/response context. Read more
Auto Trait Implementations§
impl Freeze for FeishuAuthPlugin
impl !RefUnwindSafe for FeishuAuthPlugin
impl Send for FeishuAuthPlugin
impl Sync for FeishuAuthPlugin
impl Unpin for FeishuAuthPlugin
impl UnsafeUnpin for FeishuAuthPlugin
impl !UnwindSafe for FeishuAuthPlugin
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more