Skip to content

Commit 2bd00a2

Browse files
authored
Fix OIDTokenRequest for AppAuthCore and AppAuthTV (#826)
1 parent 4b6948f commit 2bd00a2

File tree

5 files changed

+131
-13
lines changed

5 files changed

+131
-13
lines changed

AppAuth.xcodeproj/xcshareddata/xcschemes/AppAuth-macOS.xcscheme

+9-13
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
2929
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<MacroExpansion>
31+
<BuildableReference
32+
BuildableIdentifier = "primary"
33+
BlueprintIdentifier = "340DAE4D1D58216A00EC285B"
34+
BuildableName = "libAppAuth-macOS.a"
35+
BlueprintName = "AppAuth-macOS"
36+
ReferencedContainer = "container:AppAuth.xcodeproj">
37+
</BuildableReference>
38+
</MacroExpansion>
3039
<Testables>
3140
<TestableReference
3241
skipped = "NO">
@@ -39,17 +48,6 @@
3948
</BuildableReference>
4049
</TestableReference>
4150
</Testables>
42-
<MacroExpansion>
43-
<BuildableReference
44-
BuildableIdentifier = "primary"
45-
BlueprintIdentifier = "340DAE4D1D58216A00EC285B"
46-
BuildableName = "libAppAuth-macOS.a"
47-
BlueprintName = "AppAuth-macOS"
48-
ReferencedContainer = "container:AppAuth.xcodeproj">
49-
</BuildableReference>
50-
</MacroExpansion>
51-
<AdditionalOptions>
52-
</AdditionalOptions>
5351
</TestAction>
5452
<LaunchAction
5553
buildConfiguration = "Debug"
@@ -70,8 +68,6 @@
7068
ReferencedContainer = "container:AppAuth.xcodeproj">
7169
</BuildableReference>
7270
</MacroExpansion>
73-
<AdditionalOptions>
74-
</AdditionalOptions>
7571
</LaunchAction>
7672
<ProfileAction
7773
buildConfiguration = "Release"

Source/AppAuthCore/OIDTokenRequest.h

+49
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,55 @@ NS_ASSUME_NONNULL_BEGIN
105105
*/
106106
- (instancetype)init NS_UNAVAILABLE;
107107

108+
/*! @param configuration The service's configuration.
109+
@param grantType the type of token being sent to the token endpoint, i.e. "authorization_code"
110+
for the authorization code exchange, or "refresh_token" for an access token refresh request.
111+
@see OIDGrantTypes.h
112+
@param code The authorization code received from the authorization server.
113+
@param redirectURL The client's redirect URI.
114+
@param clientID The client identifier.
115+
@param clientSecret The client secret.
116+
@param scopes An array of scopes to combine into a single scope string per the OAuth2 spec.
117+
@param refreshToken The refresh token.
118+
@param codeVerifier The PKCE code verifier.
119+
@param additionalParameters The client's additional token request parameters.
120+
*/
121+
- (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration
122+
grantType:(NSString *)grantType
123+
authorizationCode:(nullable NSString *)code
124+
redirectURL:(nullable NSURL *)redirectURL
125+
clientID:(NSString *)clientID
126+
clientSecret:(nullable NSString *)clientSecret
127+
scopes:(nullable NSArray<NSString *> *)scopes
128+
refreshToken:(nullable NSString *)refreshToken
129+
codeVerifier:(nullable NSString *)codeVerifier
130+
additionalParameters:(nullable NSDictionary<NSString *, NSString *> *)additionalParameters;
131+
132+
/*! @param configuration The service's configuration.
133+
@param grantType the type of token being sent to the token endpoint, i.e. "authorization_code"
134+
for the authorization code exchange, or "refresh_token" for an access token refresh request.
135+
@see OIDGrantTypes.h
136+
@param code The authorization code received from the authorization server.
137+
@param redirectURL The client's redirect URI.
138+
@param clientID The client identifier.
139+
@param clientSecret The client secret.
140+
@param scope The value of the scope parameter is expressed as a list of space-delimited,
141+
case-sensitive strings.
142+
@param refreshToken The refresh token.
143+
@param codeVerifier The PKCE code verifier.
144+
@param additionalParameters The client's additional token request parameters.
145+
*/
146+
- (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration
147+
grantType:(NSString *)grantType
148+
authorizationCode:(nullable NSString *)code
149+
redirectURL:(nullable NSURL *)redirectURL
150+
clientID:(NSString *)clientID
151+
clientSecret:(nullable NSString *)clientSecret
152+
scope:(nullable NSString *)scope
153+
refreshToken:(nullable NSString *)refreshToken
154+
codeVerifier:(nullable NSString *)codeVerifier
155+
additionalParameters:(nullable NSDictionary<NSString *, NSString *> *)additionalParameters;
156+
108157
/*! @param configuration The service's configuration.
109158
@param grantType the type of token being sent to the token endpoint, i.e. "authorization_code"
110159
for the authorization code exchange, or "refresh_token" for an access token refresh request.

Source/AppAuthCore/OIDTokenRequest.m

+46
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,52 @@ - (instancetype)init
8989
additionalHeaders:)
9090
)
9191

92+
- (instancetype)initWithConfiguration:(nonnull OIDServiceConfiguration *)configuration
93+
grantType:(nonnull NSString *)grantType
94+
authorizationCode:(nullable NSString *)code
95+
redirectURL:(nullable NSURL *)redirectURL
96+
clientID:(nonnull NSString *)clientID
97+
clientSecret:(nullable NSString *)clientSecret
98+
scopes:(nullable NSArray<NSString *> *)scopes
99+
refreshToken:(nullable NSString *)refreshToken
100+
codeVerifier:(nullable NSString *)codeVerifier
101+
additionalParameters:(nullable NSDictionary<NSString *,NSString *> *)additionalParameters {
102+
return [self initWithConfiguration:configuration
103+
grantType:grantType
104+
authorizationCode:code
105+
redirectURL:redirectURL
106+
clientID:clientID
107+
clientSecret:clientSecret
108+
scopes:scopes
109+
refreshToken:refreshToken
110+
codeVerifier:codeVerifier
111+
additionalParameters:additionalParameters
112+
additionalHeaders:_additionalHeaders];
113+
}
114+
115+
- (instancetype)initWithConfiguration:(nonnull OIDServiceConfiguration *)configuration
116+
grantType:(nonnull NSString *)grantType
117+
authorizationCode:(nullable NSString *)code
118+
redirectURL:(nullable NSURL *)redirectURL
119+
clientID:(nonnull NSString *)clientID
120+
clientSecret:(nullable NSString *)clientSecret
121+
scope:(nullable NSString *)scope
122+
refreshToken:(nullable NSString *)refreshToken
123+
codeVerifier:(nullable NSString *)codeVerifier
124+
additionalParameters:(nullable NSDictionary<NSString *,NSString *> *)additionalParameters {
125+
return [self initWithConfiguration:configuration
126+
grantType:grantType
127+
authorizationCode:code
128+
redirectURL:redirectURL
129+
clientID:clientID
130+
clientSecret:clientSecret
131+
scope:scope
132+
refreshToken:refreshToken
133+
codeVerifier:codeVerifier
134+
additionalParameters:additionalParameters
135+
additionalHeaders:_additionalHeaders];
136+
}
137+
92138
- (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration
93139
grantType:(NSString *)grantType
94140
authorizationCode:(nullable NSString *)code

Source/AppAuthTV/OIDTVTokenRequest.h

+14
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,20 @@ NS_ASSUME_NONNULL_BEGIN
8080
(nullable NSDictionary<NSString *, NSString *> *)additionalHeaders
8181
NS_UNAVAILABLE;
8282

83+
/*! @brief Designated initializer.
84+
@param configuration The service's configuration.
85+
@param deviceCode The device verification code received from the authorization server.
86+
@param clientID The client identifier.
87+
@param clientSecret The client secret (nullable).
88+
@param additionalParameters The client's additional token request parameters.
89+
*/
90+
- (instancetype)initWithConfiguration:(OIDTVServiceConfiguration *)configuration
91+
deviceCode:(NSString *)deviceCode
92+
clientID:(NSString *)clientID
93+
clientSecret:(nullable NSString *)clientSecret
94+
additionalParameters:
95+
(nullable NSDictionary<NSString *, NSString *> *)additionalParameters;
96+
8397
/*! @brief Designated initializer.
8498
@param configuration The service's configuration.
8599
@param deviceCode The device verification code received from the authorization server.

Source/AppAuthTV/OIDTVTokenRequest.m

+13
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,19 @@ - (instancetype)initWithConfiguration:(OIDServiceConfiguration *)configuration
9090
additionalHeaders:
9191
))
9292

93+
- (instancetype)initWithConfiguration:(OIDTVServiceConfiguration *)configuration
94+
deviceCode:(NSString *)deviceCode
95+
clientID:(NSString *)clientID
96+
clientSecret:(NSString *)clientSecret
97+
additionalParameters:(NSDictionary<NSString *, NSString *> *)additionalParameters {
98+
return [self initWithConfiguration:configuration
99+
deviceCode:deviceCode
100+
clientID:clientID
101+
clientSecret:clientSecret
102+
additionalParameters:additionalParameters
103+
additionalHeaders:nil];
104+
}
105+
93106
- (instancetype)initWithConfiguration:(OIDTVServiceConfiguration *)configuration
94107
deviceCode:(NSString *)deviceCode
95108
clientID:(NSString *)clientID

0 commit comments

Comments
 (0)