Skip to content

Commit

Permalink
Fix OIDTokenRequest for AppAuthCore and AppAuthTV (#826)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdmathias committed Mar 9, 2024
1 parent 4b6948f commit 2bd00a2
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 13 deletions.
22 changes: 9 additions & 13 deletions AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuth-macOS.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "340DAE4D1D58216A00EC285B"
BuildableName = "libAppAuth-macOS.a"
BlueprintName = "AppAuth-macOS"
ReferencedContainer = "container:AppAuth.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -39,17 +48,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "340DAE4D1D58216A00EC285B"
BuildableName = "libAppAuth-macOS.a"
BlueprintName = "AppAuth-macOS"
ReferencedContainer = "container:AppAuth.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -70,8 +68,6 @@
ReferencedContainer = "container:AppAuth.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
49 changes: 49 additions & 0 deletions Source/AppAuthCore/OIDTokenRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,55 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (instancetype)init NS_UNAVAILABLE;

/*! @param configuration The service's configuration.
@param grantType the type of token being sent to the token endpoint, i.e. "authorization_code"
for the authorization code exchange, or "refresh_token" for an access token refresh request.
@see OIDGrantTypes.h
@param code The authorization code received from the authorization server.
@param redirectURL The client's redirect URI.
@param clientID The client identifier.
@param clientSecret The client secret.
@param scopes An array of scopes to combine into a single scope string per the OAuth2 spec.
@param refreshToken The refresh token.
@param codeVerifier The PKCE code verifier.
@param additionalParameters The client's additional token request parameters.
*/
- (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration
grantType:(NSString *)grantType
authorizationCode:(nullable NSString *)code
redirectURL:(nullable NSURL *)redirectURL
clientID:(NSString *)clientID
clientSecret:(nullable NSString *)clientSecret
scopes:(nullable NSArray<NSString *> *)scopes
refreshToken:(nullable NSString *)refreshToken
codeVerifier:(nullable NSString *)codeVerifier
additionalParameters:(nullable NSDictionary<NSString *, NSString *> *)additionalParameters;

/*! @param configuration The service's configuration.
@param grantType the type of token being sent to the token endpoint, i.e. "authorization_code"
for the authorization code exchange, or "refresh_token" for an access token refresh request.
@see OIDGrantTypes.h
@param code The authorization code received from the authorization server.
@param redirectURL The client's redirect URI.
@param clientID The client identifier.
@param clientSecret The client secret.
@param scope The value of the scope parameter is expressed as a list of space-delimited,
case-sensitive strings.
@param refreshToken The refresh token.
@param codeVerifier The PKCE code verifier.
@param additionalParameters The client's additional token request parameters.
*/
- (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration
grantType:(NSString *)grantType
authorizationCode:(nullable NSString *)code
redirectURL:(nullable NSURL *)redirectURL
clientID:(NSString *)clientID
clientSecret:(nullable NSString *)clientSecret
scope:(nullable NSString *)scope
refreshToken:(nullable NSString *)refreshToken
codeVerifier:(nullable NSString *)codeVerifier
additionalParameters:(nullable NSDictionary<NSString *, NSString *> *)additionalParameters;

/*! @param configuration The service's configuration.
@param grantType the type of token being sent to the token endpoint, i.e. "authorization_code"
for the authorization code exchange, or "refresh_token" for an access token refresh request.
Expand Down
46 changes: 46 additions & 0 deletions Source/AppAuthCore/OIDTokenRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,52 @@ - (instancetype)init
additionalHeaders:)
)

- (instancetype)initWithConfiguration:(nonnull OIDServiceConfiguration *)configuration
grantType:(nonnull NSString *)grantType
authorizationCode:(nullable NSString *)code
redirectURL:(nullable NSURL *)redirectURL
clientID:(nonnull NSString *)clientID
clientSecret:(nullable NSString *)clientSecret
scopes:(nullable NSArray<NSString *> *)scopes
refreshToken:(nullable NSString *)refreshToken
codeVerifier:(nullable NSString *)codeVerifier
additionalParameters:(nullable NSDictionary<NSString *,NSString *> *)additionalParameters {
return [self initWithConfiguration:configuration
grantType:grantType
authorizationCode:code
redirectURL:redirectURL
clientID:clientID
clientSecret:clientSecret
scopes:scopes
refreshToken:refreshToken
codeVerifier:codeVerifier
additionalParameters:additionalParameters
additionalHeaders:_additionalHeaders];
}

- (instancetype)initWithConfiguration:(nonnull OIDServiceConfiguration *)configuration
grantType:(nonnull NSString *)grantType
authorizationCode:(nullable NSString *)code
redirectURL:(nullable NSURL *)redirectURL
clientID:(nonnull NSString *)clientID
clientSecret:(nullable NSString *)clientSecret
scope:(nullable NSString *)scope
refreshToken:(nullable NSString *)refreshToken
codeVerifier:(nullable NSString *)codeVerifier
additionalParameters:(nullable NSDictionary<NSString *,NSString *> *)additionalParameters {
return [self initWithConfiguration:configuration
grantType:grantType
authorizationCode:code
redirectURL:redirectURL
clientID:clientID
clientSecret:clientSecret
scope:scope
refreshToken:refreshToken
codeVerifier:codeVerifier
additionalParameters:additionalParameters
additionalHeaders:_additionalHeaders];
}

- (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration
grantType:(NSString *)grantType
authorizationCode:(nullable NSString *)code
Expand Down
14 changes: 14 additions & 0 deletions Source/AppAuthTV/OIDTVTokenRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,20 @@ NS_ASSUME_NONNULL_BEGIN
(nullable NSDictionary<NSString *, NSString *> *)additionalHeaders
NS_UNAVAILABLE;

/*! @brief Designated initializer.
@param configuration The service's configuration.
@param deviceCode The device verification code received from the authorization server.
@param clientID The client identifier.
@param clientSecret The client secret (nullable).
@param additionalParameters The client's additional token request parameters.
*/
- (instancetype)initWithConfiguration:(OIDTVServiceConfiguration *)configuration
deviceCode:(NSString *)deviceCode
clientID:(NSString *)clientID
clientSecret:(nullable NSString *)clientSecret
additionalParameters:
(nullable NSDictionary<NSString *, NSString *> *)additionalParameters;

/*! @brief Designated initializer.
@param configuration The service's configuration.
@param deviceCode The device verification code received from the authorization server.
Expand Down
13 changes: 13 additions & 0 deletions Source/AppAuthTV/OIDTVTokenRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,19 @@ - (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration
additionalHeaders:
))

- (instancetype)initWithConfiguration:(OIDTVServiceConfiguration *)configuration
deviceCode:(NSString *)deviceCode
clientID:(NSString *)clientID
clientSecret:(NSString *)clientSecret
additionalParameters:(NSDictionary<NSString *, NSString *> *)additionalParameters {
return [self initWithConfiguration:configuration
deviceCode:deviceCode
clientID:clientID
clientSecret:clientSecret
additionalParameters:additionalParameters
additionalHeaders:nil];
}

- (instancetype)initWithConfiguration:(OIDTVServiceConfiguration *)configuration
deviceCode:(NSString *)deviceCode
clientID:(NSString *)clientID
Expand Down

0 comments on commit 2bd00a2

Please sign in to comment.