9 #import <Foundation/Foundation.h> 10 @
import SafariServices;
12 #import "MFServiceConfiguration.h" 17 @protocol OIDAuthorizationFlowSession;
26 typedef void (^MFDiscoveryCallback)(
MFServiceConfiguration *_Nullable configuration, NSError *_Nullable error);
28 typedef void (^MFAuthorizationFlowCallback)(id<OIDAuthorizationFlowSession> _Nullable currentAuthFlowSession,
29 NSError *_Nullable error);
35 typedef void (^MFSignInCompletionCallback)(BOOL success, NSError *_Nullable error);
42 typedef void (^MFResponseCallback)(NSData *_Nullable data, NSURLResponse *_Nullable response, NSError *_Nullable error);
48 typedef void (^MFUserInfoCallback)(NSDictionary *_Nullable dictUserData, NSError *_Nullable error);
55 typedef void (^MFAuthStateAction)(NSString *_Nullable accessToken, NSString *_Nullable idToken, NSError *_Nullable error);
63 @property(nonatomic, readonly, nullable)
OIDAuthState *authState;
83 + (void) discoverServiceConfiguration:(nonnull NSURL *) discoveryUrl completion:(nonnull MFDiscoveryCallback) completionCallback;
91 - (nullable instancetype) init NS_UNAVAILABLE;
99 NS_DESIGNATED_INITIALIZER;
107 - (nullable instancetype) initWithAuthzEndpoint:(nonnull NSURL *) authorizationUrl
108 tokenEndpoint:(nonnull NSURL *) tokenUrl
109 revocationEndpoint:(nullable NSURL *) revocationUrl
110 userinfoEndpoint:(nullable NSURL *) userinfoUrl;
119 - (nullable instancetype) initWithAuthzEndpoint:(nonnull NSURL *) authorizationUrl
120 tokenEndpoint:(nonnull NSURL *) tokenUrl
121 revocationEndpoint:(nullable NSURL *) revocationUrl
122 userinfoEndpoint:(nullable NSURL *) userinfoUrl
123 browserLogoutEndpoint:(nullable NSURL *) browserLogoutUrl;
129 - (nullable instancetype) initWithProvider:(nonnull NSURL *) providerBaseUrl;
136 - (nullable instancetype) initWithIssuerUrl:(nonnull NSURL *) issuerUrl
137 logoutUrl:(nullable NSURL *) logoutUrl;
146 - (void)setAuthState:(nullable
OIDAuthState *)authState;
169 - (nullable id<OIDAuthorizationFlowSession>) signInWithClientId:(nonnull NSString *) clientId
170 clientSecret:(nullable NSString *) clientSecret
171 scopes:(nullable NSArray<NSString *> *) scopes
172 redirectURL:(nullable NSURL *) redirectURL
173 presentingViewController:(nonnull UIViewController *) presentingVC
174 withBlock:(nonnull MFSignInCompletionCallback) callbackBlock;
191 - (nullable id<OIDAuthorizationFlowSession>) signInWithClientId:(nonnull NSString *) clientId
192 clientSecret:(nullable NSString *) clientSecret
193 scopes:(nullable NSArray<NSString *> *) scopes
194 redirectURL:(nullable NSURL *) redirectURL
195 responseType:(nullable NSString *) responseType
196 additionalParameters:(nullable NSMutableDictionary<NSString *, NSString *> *) additionalParameters
197 presentingViewController:(nonnull UIViewController *) presentingVC
198 withBlock:(nonnull MFSignInCompletionCallback) callbackBlock;
205 - (void) getUserInfoResponse:(nonnull MFResponseCallback) completionHandler;
212 - (void) getUserInfo:(nonnull MFUserInfoCallback) completionHandler;
218 - (void) performActionWithFreshToken:(nonnull MFAuthStateAction) action;
225 - (void) performHTTPRequestWithFreshToken:(nonnull NSURL *) requestUrl
226 withCompletionHandler:(nonnull MFResponseCallback) handler;
244 - (void) logout:(nonnull UIViewController *) presentingVC;
248 - (void) revokeToken:(nonnull NSURL *) revocationEndpoint;
void loadState()
load state with tokens from device keychain
Definition: MFAuthService.m:192
Represents the information needed to construct a OIDAuthorizationService.
Definition: OIDServiceConfiguration.h:35
void saveState()
save state with tokens to device keychain
Definition: MFAuthService.m:182
nullable NSString * getAccessToken()
Get the access token.
Definition: MFAuthService.m:525
void removeKeychainEntry()
Remove an existing Keychain entry with tokens. This can be used for e.g. when the orphaned tokens nee...
Definition: MFAuthService.m:54
nullable NSString * getAccessTokenExpiryTimeString()
Get the access token expiration time string in local time.
Definition: MFAuthService.m:534
This extends the OIDServiceConfiguration class and adds few additional properties.
Definition: MFServiceConfiguration.h:13
A convenience class that retains the auth state between OIDAuthorizationResponses and OIDTokenRespons...
Definition: OIDAuthState.h:54
MFServiceConfiguration * config
The service's configuration.
Definition: MFAuthService.h:73
BOOL isAuthorized()
Is already authorized.
Definition: MFAuthService.m:164
Performs various OAuth and OpenID Connect related calls via the user agent or .
Definition: MFAuthService.h:61