Skip to content

Commit e02b68d

Browse files
committed
Run cargo fmt
1 parent c24bef6 commit e02b68d

File tree

2 files changed

+36
-12
lines changed

2 files changed

+36
-12
lines changed

src/lib.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,9 @@ pub use url;
495495

496496
pub use types::{
497497
AccessToken, AuthUrl, AuthorizationCode, ClientId, ClientSecret, CsrfToken,
498-
DeviceAuthorizationUrl, DeviceCode, EndUserVerificationUrl, IntrospectionUrl, PkceCodeChallenge,
499-
PkceCodeChallengeMethod, PkceCodeVerifier, RedirectUrl, RefreshToken, ResourceOwnerPassword,
500-
ResourceOwnerUsername, ResponseType, Scope, TokenUrl, UserCode,
498+
DeviceAuthorizationUrl, DeviceCode, EndUserVerificationUrl, IntrospectionUrl,
499+
PkceCodeChallenge, PkceCodeChallengeMethod, PkceCodeVerifier, RedirectUrl, RefreshToken,
500+
ResourceOwnerPassword, ResourceOwnerUsername, ResponseType, Scope, TokenUrl, UserCode,
501501
};
502502

503503
const CONTENT_TYPE_JSON: &str = "application/json";
@@ -805,7 +805,10 @@ where
805805
/// Query the authorization server [`RFC 7662 compatible`](https://tools.ietf.org/html/rfc7662) introspection
806806
/// endpoint to determine the set of metadata for a previously received token.
807807
///
808-
pub fn introspect<'a>(&'a self, token: &'a AccessToken) -> IntrospectionRequest<'a, TE, TIR, TT> {
808+
pub fn introspect<'a>(
809+
&'a self,
810+
token: &'a AccessToken,
811+
) -> IntrospectionRequest<'a, TE, TIR, TT> {
809812
IntrospectionRequest {
810813
auth_type: &self.auth_type,
811814
client_id: &self.client_id,
@@ -1533,7 +1536,9 @@ where
15331536
None,
15341537
None,
15351538
self.introspection_url
1536-
.ok_or_else(|| RequestTokenError::Other("no introspection_url provided".to_string()))?
1539+
.ok_or_else(|| {
1540+
RequestTokenError::Other("no introspection_url provided".to_string())
1541+
})?
15371542
.url(),
15381543
params,
15391544
))

src/tests.rs

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,7 +1512,9 @@ fn test_token_introspection_successful_with_basic_auth_minimal_response() {
15121512
let client = new_client()
15131513
.set_auth_type(AuthType::BasicAuth)
15141514
.set_redirect_url(RedirectUrl::new("https://redirect/here".to_string()).unwrap())
1515-
.set_introspection_url(IntrospectionUrl::new("https://introspection/url".to_string()).unwrap());
1515+
.set_introspection_url(
1516+
IntrospectionUrl::new("https://introspection/url".to_string()).unwrap(),
1517+
);
15161518

15171519
let introspection_response = client
15181520
.introspect(&AccessToken::new("access_token_123".to_string()))
@@ -1560,7 +1562,9 @@ fn test_token_introspection_successful_with_basic_auth_full_response() {
15601562
let client = new_client()
15611563
.set_auth_type(AuthType::BasicAuth)
15621564
.set_redirect_url(RedirectUrl::new("https://redirect/here".to_string()).unwrap())
1563-
.set_introspection_url(IntrospectionUrl::new("https://introspection/url".to_string()).unwrap());
1565+
.set_introspection_url(
1566+
IntrospectionUrl::new("https://introspection/url".to_string()).unwrap(),
1567+
);
15641568

15651569
let introspection_response = client
15661570
.introspect(&AccessToken::new("access_token_123".to_string()))
@@ -1609,12 +1613,27 @@ fn test_token_introspection_successful_with_basic_auth_full_response() {
16091613
]),
16101614
introspection_response.scopes
16111615
);
1612-
assert_eq!(Some(ClientId::new("aaa".to_string())), introspection_response.client_id);
1616+
assert_eq!(
1617+
Some(ClientId::new("aaa".to_string())),
1618+
introspection_response.client_id
1619+
);
16131620
assert_eq!(Some("demo".to_string()), introspection_response.username);
1614-
assert_eq!(Some(BasicTokenType::Bearer), introspection_response.token_type);
1615-
assert_eq!(Some(Utc.timestamp(1604073517, 0)), introspection_response.exp);
1616-
assert_eq!(Some(Utc.timestamp(1604073217, 0)), introspection_response.iat);
1617-
assert_eq!(Some(Utc.timestamp(1604073317, 0)), introspection_response.nbf);
1621+
assert_eq!(
1622+
Some(BasicTokenType::Bearer),
1623+
introspection_response.token_type
1624+
);
1625+
assert_eq!(
1626+
Some(Utc.timestamp(1604073517, 0)),
1627+
introspection_response.exp
1628+
);
1629+
assert_eq!(
1630+
Some(Utc.timestamp(1604073217, 0)),
1631+
introspection_response.iat
1632+
);
1633+
assert_eq!(
1634+
Some(Utc.timestamp(1604073317, 0)),
1635+
introspection_response.nbf
1636+
);
16181637
assert_eq!(Some("demo".to_string()), introspection_response.sub);
16191638
assert_eq!(Some(vec!["demo".to_string()]), introspection_response.aud);
16201639
assert_eq!(

0 commit comments

Comments
 (0)