Skip to content

Commit

Permalink
Updating the docs to match the code
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Farris committed Jan 24, 2018
1 parent 20fca6d commit 4e29b98
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 47 deletions.
5 changes: 2 additions & 3 deletions Source/OIDAuthState.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,11 @@ typedef void (^OIDAuthStateAuthorizationCallback)(OIDAuthState *_Nullable authSt
/*! @brief Convenience method to create a @c OIDAuthState by presenting an authorization request
and performing the authorization code exchange in the case of code flow requests.
@param authorizationRequest The authorization request to present.
@param UICoordinator Generic user-agent UI coordinator that can present an authorization
request.
@param UICoordinator Generic UI coordinator that can present an user-agent request.
@param callback The method called when the request has completed or failed.
@return A @c OIDUserAgentFlowSession instance which will terminate when it
receives a @c OIDUserAgentFlowSession.cancel message, or after processing a
@c OIDUserAgentFlowSession.resumeAuthorizationFlowWithURL: message.
@c OIDUserAgentFlowSession.resumeUserAgentFlowWithURL: message.
*/
+ (id<OIDUserAgentFlowSession>)
authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest
Expand Down
1 change: 0 additions & 1 deletion Source/OIDAuthorizationRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -339,5 +339,4 @@ - (NSString *)redirectScheme {
return [[self redirectURL] scheme];
}


@end
6 changes: 3 additions & 3 deletions Source/OIDAuthorizationService.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ typedef void (^OIDRegistrationCompletion)(OIDRegistrationResponse *_Nullable reg
@param UICoordinator Generic authorization UI coordinator that can present an authorization
request.
@param callback The method called when the request has completed or failed.
@return A @c OIDAuthorizationFlowSession instance which will terminate when it
receives a @c OIDAuthorizationFlowSession.cancel message, or after processing a
@c OIDAuthorizationFlowSession.resumeAuthorizationFlowWithURL: message.
@return A @c OIDUserAgentFlowSession instance which will terminate when it
receives a @c OIDUserAgentFlowSession.cancel message, or after processing a
@c OIDUserAgentFlowSession.resumeUserAgentFlowWithURL: message.
*/
+ (id<OIDUserAgentFlowSession>)
presentAuthorizationRequest:(OIDAuthorizationRequest *)request
Expand Down
10 changes: 5 additions & 5 deletions Source/OIDUserAgentFlowSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

/*! @brief Cancels the code flow session, invoking the request's callback with a cancelled error.
@remarks Has no effect if called more than once, or after a
@c OIDUserAgentFlowSession.resumeAuthorizationFlowWithURL: message was received. Will
@c OIDUserAgentFlowSession.resumeUserAgentFlowWithURL: message was received. Will
cause an error with code: @c ::OIDErrorCodeProgramCanceledAuthorizationFlow to be passed to
the @c callback block passed to
@c OIDAuthorizationService.presentAuthorizationRequest:presentingViewController:callback:
Expand All @@ -34,16 +34,16 @@
becomes available.
@param URL The redirect URL invoked by the server.
@discussion When the URL represented a valid response, implementations should clean up any
left-over UI state from the authorization, for example by closing the
left-over UI state from the request, for example by closing the
\SFSafariViewController or loopback HTTP listener if those were used. The completion block
of the pending user-agent request should then be invoked.
of the pending request should then be invoked.
@remarks Has no effect if called more than once, or after a @c cancel message was received.
@return YES if the passed URL matches the expected redirect URL and was consumed, NO otherwise.
*/
- (BOOL)resumeUserAgentFlowWithURL:(NSURL *)URL;

/*! @brief @c OIDUserAgentUICoordinator or clients should call this method when the
authorization flow failed with a non-OAuth error.
/*! @brief @c OIDUserAgentUICoordinator or clients should call this method when the user-agent flow
failed with a non-OAuth error.
@param error The error that is the reason for the failure of this user-agent flow.
@remarks Has no effect if called more than once, or after a @c cancel message was received.
*/
Expand Down
5 changes: 2 additions & 3 deletions Source/OIDUserAgentUICoordinator.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@

#import <Foundation/Foundation.h>

@class OIDAuthorizationRequest;
@protocol OIDUserAgentFlowSession;
@protocol OIDUserAgentRequest;

NS_ASSUME_NONNULL_BEGIN

/*! @protocol OIDAuthorizationUICoordinator
/*! @protocol OIDUserAgentUICoordinator
@brief An user-agent UI coordinator that presents a request. Clients may provide custom
implementations of an authorization UI coordinator to customize the way the requests are
implementations of an user-agent UI coordinator to customize the way the requests are
presented to the end user.
*/
@protocol OIDUserAgentUICoordinator<NSObject>
Expand Down
6 changes: 3 additions & 3 deletions Source/iOS/OIDAuthState+IOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ NS_ASSUME_NONNULL_BEGIN
@param presentingViewController The view controller from which to present the
@c SFSafariViewController.
@param callback The method called when the request has completed or failed.
@return A @c OIDAuthorizationFlowSession instance which will terminate when it
receives a @c OIDAuthorizationFlowSession.cancel message, or after processing a
@c OIDAuthorizationFlowSession.resumeAuthorizationFlowWithURL: message.
@return A @c OIDUserAgentFlowSession instance which will terminate when it
receives a @c OIDUserAgentFlowSession.cancel message, or after processing a
@c OIDUserAgentFlowSession.resumeAuthorizationFlowWithURL: message.
*/
+ (id<OIDUserAgentFlowSession>)
authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest
Expand Down
6 changes: 3 additions & 3 deletions Source/iOS/OIDAuthorizationService+IOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ NS_ASSUME_NONNULL_BEGIN
@param presentingViewController The view controller from which to present the
\SFSafariViewController.
@param callback The method called when the request has completed or failed.
@return A @c OIDAuthorizationFlowSession instance which will terminate when it
receives a @c OIDAuthorizationFlowSession.cancel message, or after processing a
@c OIDAuthorizationFlowSession.resumeAuthorizationFlowWithURL: message.
@return A @c OIDUserAgentFlowSession instance which will terminate when it
receives a @c OIDUserAgentFlowSession.cancel message, or after processing a
@c OIDUserAgentFlowSession.resumeUserAgentFlowWithURL: message.
*/
+ (id<OIDUserAgentFlowSession>)
presentAuthorizationRequest:(OIDAuthorizationRequest *)request
Expand Down
6 changes: 3 additions & 3 deletions Source/macOS/OIDAuthState+Mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ NS_ASSUME_NONNULL_BEGIN
and performing the authorization code exchange in the case of code flow requests.
@param authorizationRequest The authorization request to present.
@param callback The method called when the request has completed or failed.
@return A @c OIDAuthorizationFlowSession instance which will terminate when it
receives a @c OIDAuthorizationFlowSession.cancel message, or after processing a
@c OIDAuthorizationFlowSession.resumeAuthorizationFlowWithURL: message.
@return A @c OIDUserAgentFlowSession instance which will terminate when it
receives a @c OIDUserAgentFlowSession.cancel message, or after processing a
@c OIDUserAgentFlowSession.resumeUserAgentFlowWithURL: message.
*/
+ (id<OIDUserAgentFlowSession>)
authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest
Expand Down
6 changes: 3 additions & 3 deletions Source/macOS/OIDAuthorizationService+Mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ NS_ASSUME_NONNULL_BEGIN
/*! @brief Perform an authorization flow using the default browser.
@param request The authorization request.
@param callback The method called when the request has completed or failed.
@return A @c OIDAuthorizationFlowSession instance which will terminate when it
receives a @c OIDAuthorizationFlowSession.cancel message, or after processing a
@c OIDAuthorizationFlowSession.resumeAuthorizationFlowWithURL: message.
@return A @c OIDUserAgentFlowSession instance which will terminate when it
receives a @c OIDUserAgentFlowSession.cancel message, or after processing a
@c OIDUserAgentFlowSession.resumeUserAgentFlowWithURL: message.
*/
+ (id<OIDUserAgentFlowSession>)presentAuthorizationRequest:(OIDAuthorizationRequest *)request
callback:(OIDAuthorizationCallback)callback;
Expand Down
36 changes: 18 additions & 18 deletions Source/macOS/OIDRedirectHTTPHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ NS_ASSUME_NONNULL_BEGIN
@class HTTPServer;
@protocol OIDUserAgentFlowSession;

/*! @brief Start a HTTP server on the loopback interface (i.e. @c 127.0.0.1) to receive OAuth
authorization response redirects on macOS.
/*! @brief Start a HTTP server on the loopback interface (i.e. @c 127.0.0.1) to receive the OAuth
response redirects on macOS.
*/
@interface OIDRedirectHTTPHandler : NSObject {
// private variables
Expand All @@ -34,41 +34,41 @@ NS_ASSUME_NONNULL_BEGIN
NSObject<OIDUserAgentFlowSession> *_currentUserAgentFlow;
}

/*! @brief The authorization flow session which receives the return URL from the browser.
/*! @brief The user-agent request flow session which receives the return URL from the browser.
@discussion The loopback HTTP server will try sending incoming request URLs to the OAuth
redirect handler to continue the flow. This should be set while an authorization flow is
redirect handler to continue the flow. This should be set while a user-agent request flow is
in progress.
*/
@property(nonatomic, strong, nullable) id<OIDUserAgentFlowSession> currentUserAgentFlow;

/*! @brief Creates an a loopback HTTP redirect URI handler with the given success URL.
@param successURL The URL that the user is redirected to after the authorization flow completes
@param successURL The URL that the user is redirected to after the request flow completes
either with a result of success or error. The contents of this page should instruct the user
to return to the app.
@discussion Once you have initiated the authorization request, be sure to set
@c currentAuthorizationFlow on this object so that any authorization responses received by
this listener will be routed accordingly.
@discussion Once you have initiated the user-agent request, be sure to set
@c currentUserAgentFlow on this object so that any responses received by this listener will
be routed accordingly.
*/
- (instancetype)initWithSuccessURL:(nullable NSURL *)successURL;

/*! @brief Starts listening on the loopback interface on a random available port, and returns a URL
with the base address. Use the returned redirect URI to build an @c OIDAuthorizationRequest,
and once you initiate the request, set the resulting @c OIDAuthorizationFlowSession to
@c currentAuthorizationFlow so the response can be handled.
with the base address. Use the returned redirect URI to build a @c OIDUserAgentRequest,
and once you initiate the request, set the resulting @c OIDUserAgentFlowSession to
@c currentUserAgentFlow so the response can be handled.
@param error The error if an error occurred while starting the local HTTP server.
@return The URL containing the address of the server with the randomly assigned available port.
@discussion Each instance of @c OIDRedirectHTTPHandler can only listen for a single
authorization response. Calling this more than once will result in the previous listener
being cancelled (equivalent of @c cancelHTTPListener being called).
@discussion Each instance of @c OIDRedirectHTTPHandler can only listen for a single response.
Calling this more than once will result in the previous listener being cancelled (equivalent
of @c cancelHTTPListener being called).
*/
- (NSURL *)startHTTPListener:(NSError **)error;

/*! @brief Stops listening the loopback interface and sends an cancellation error (in the domain
::OIDGeneralErrorDomain, with the code ::OIDErrorCodeProgramCanceledAuthorizationFlow) to
the @c currentAuthorizationFlow. Has no effect if called when no requests are pending.
@discussion The HTTP listener is stopped automatically on receiving a valid authorization
response (regardless of whether the authorization succeeded or not), this method should not
be called except when abandoning the authorization request.
the @c currentUserAgentFlow. Has no effect if called when no requests are pending.
@discussion The HTTP listener is stopped automatically on receiving a valid response (regardless
of whether the request succeeded or not), this method should not be called except when
abandoning the user-agent request.
*/
- (void)cancelHTTPListener;

Expand Down
4 changes: 2 additions & 2 deletions Source/macOS/OIDUserAgentUICoordinatorMac.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

NS_ASSUME_NONNULL_BEGIN

/*! @brief An Mac specific authorization UI Coordinator that uses the default browser to
present an authorization request.
/*! @brief A Mac-specific user-agent UI Coordinator that uses the default browser to
present a request.
*/
@interface OIDUserAgentUICoordinatorMac : NSObject <OIDUserAgentUICoordinator> {
// private variables
Expand Down

0 comments on commit 4e29b98

Please sign in to comment.