Skip to content

Commit e1f6e14

Browse files
committed
docs: update SourceDocs
1 parent 98f0e2e commit e1f6e14

15 files changed

+208
-66
lines changed

Documentation/Reference/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
## Structs
88

99
- [AuthorizationConfiguration](structs/AuthorizationConfiguration.md)
10-
- [FusionAuthStateData](structs/FusionAuthStateData.md)
10+
- [FusionAuthState](structs/FusionAuthState.md)
1111
- [IdToken](structs/IdToken.md)
1212
- [OAuthAuthorization](structs/OAuthAuthorization.md)
1313
- [OAuthAuthorizeOptions](structs/OAuthAuthorizeOptions.md)
@@ -17,11 +17,9 @@
1717
## Classes
1818

1919
- [AuthorizationManager](classes/AuthorizationManager.md)
20-
- [FusionAuthState](classes/FusionAuthState.md)
2120
- [KeyChainStorage](classes/KeyChainStorage.md)
2221
- [MemoryStorage](classes/MemoryStorage.md)
2322
- [OAuthAuthorizationService](classes/OAuthAuthorizationService.md)
24-
- [OAuthAuthorizationStore](classes/OAuthAuthorizationStore.md)
2523
- [TokenManager](classes/TokenManager.md)
2624
- [UserDefaultsStorage](classes/UserDefaultsStorage.md)
2725

@@ -31,6 +29,8 @@
3129

3230
## Extensions
3331

32+
- [AuthorizationConfiguration](extensions/AuthorizationConfiguration.md)
3433
- [AuthorizationManager](extensions/AuthorizationManager.md)
34+
- [OAuthAuthorizationService](extensions/OAuthAuthorizationService.md)
3535

36-
This file was generated by [SourceDocs](https://github.com/eneko/SourceDocs) on 2024-10-24 13:51:59 +0000
36+
This file was generated by [SourceDocs](https://github.com/eneko/SourceDocs) on 2024-11-06 09:44:20 +0000

Documentation/Reference/classes/AuthorizationManager.md

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,69 +20,64 @@ to store the authorization state.
2020
public static let instance = AuthorizationManager()
2121
```
2222

23+
The shared instance of the AuthorizationManager
24+
2325
## Methods
2426
### `initialize(configuration:storage:)`
2527

2628
```swift
27-
public func initialize(configuration: AuthorizationConfiguration, storage: Storage? = nil)
29+
@discardableResult public func initialize(configuration: AuthorizationConfiguration, storage: Storage? = nil) -> Self
2830
```
2931

30-
### `fusionAuthState()`
31-
32-
```swift
33-
public func fusionAuthState() -> FusionAuthState
34-
```
32+
Initialize the AuthorizationManager with the given configuration
3533

3634
### `getTokenManager()`
3735

3836
```swift
3937
public func getTokenManager() -> TokenManager
4038
```
4139

42-
### `oauth()`
43-
44-
```swift
45-
public func oauth() -> OAuthAuthorizationService
46-
```
40+
Returns the current TokenManager
4741

4842
### `freshAccessToken(force:)`
4943

5044
```swift
5145
public func freshAccessToken(force: Bool = false) async throws -> String?
5246
```
5347

48+
Returns a fresh access token
49+
50+
If the access token is not expired, it will be returned immediately.
51+
If the access token is expired or force is `true`, a new access token will be fetched using the refresh token.
52+
5453
### `getAccessToken()`
5554

5655
```swift
5756
public func getAccessToken() -> String?
5857
```
5958

59+
Retrieves the access token, if available
60+
6061
### `getAccessTokenExpirationTime()`
6162

6263
```swift
6364
public func getAccessTokenExpirationTime() -> Date?
6465
```
6566

67+
Retrieves the access token expiration, if available
68+
6669
### `isAccessTokenExpired()`
6770

6871
```swift
6972
public func isAccessTokenExpired() -> Bool
7073
```
7174

72-
### `updateAuthState(authState:)`
73-
74-
```swift
75-
public func updateAuthState(authState: OIDAuthState) throws
76-
```
75+
Checks if the stored access token is expired.
7776

78-
### `updateAuthState(accessToken:accessTokenExpirationTime:idToken:refreshToken:)`
77+
### `getIdToken()`
7978

8079
```swift
81-
public func updateAuthState(accessToken: String, accessTokenExpirationTime: Date, idToken: String, refreshToken: String) throws
80+
public func getIdToken() -> String?
8281
```
8382

84-
### `clearState()`
85-
86-
```swift
87-
public func clearState() throws
88-
```
83+
Retrieves the ID token, if available

Documentation/Reference/classes/KeyChainStorage.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66
public class KeyChainStorage: Storage
77
```
88

9-
TODO
10-
Storage that saves data to the KeyChain.
11-
This storage is secure and the data is encrypted.
12-
The data is persisted even when the app is closed.
9+
Implemenation of the `Storage` protocol that uses the iOS KeyChain to store and retrieve sensitive data.
10+
- Note: The KeyChain is a secure storage mechanism that is used to store sensitive data such as passwords, keys, and certificates.
1311

1412
## Methods
1513
### `init()`

Documentation/Reference/classes/MemoryStorage.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
public class MemoryStorage: Storage
77
```
88

9-
TODO
10-
Storage that keeps the data in memory.
11-
This storage is not persistent and the data is lost when the app is closed.
9+
Implementation of the Storage protocol that stores data in memory.
10+
- Note: This implementation is useful for testing and development purposes, as it does not persist data across app launches.
1211

1312
## Methods
1413
### `init()`

Documentation/Reference/classes/OAuthAuthorizationService.md

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,3 @@ public class OAuthAuthorizationService
99
OAuthAuthorizationService class is responsible for handling OAuth authorization and authorization process.
1010
It provides methods to authorize the user, handle the redirect intent, fetch user information,
1111
perform logout, retrieve fresh access token, and get the authorization service.
12-
13-
## Methods
14-
### `authorize(options:)`
15-
16-
```swift
17-
public func authorize(options: OAuthAuthorizeOptions) async throws -> OIDAuthState
18-
```
19-
20-
### `userInfo()`
21-
22-
```swift
23-
public func userInfo() async throws -> UserInfo
24-
```
25-
26-
### `logout(options:)`
27-
28-
```swift
29-
public func logout(options: OAuthLogoutOptions) async throws
30-
```
31-
32-
### `freshAccessToken()`
33-
34-
```swift
35-
public func freshAccessToken() async throws -> String?
36-
```

Documentation/Reference/classes/TokenManager.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
public class TokenManager
77
```
88

9-
TODO
10-
TokenManager is a singleton object that manages the access tokens.
11-
It provides methods to get and set the access, refresh and ID tokens.
12-
It uses one of the configured Storage implementations to store the access tokens.
9+
TokenManager is responsible for managing the authorization tokens.
10+
It provides methods to get, save, and clear the access, refresh, and ID tokens.
11+
The tokens are stored using a configured Storage implementation.

Documentation/Reference/classes/UserDefaultsStorage.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
public class UserDefaultsStorage: Storage
77
```
88

9-
Storage that saves data to UserDefaults.
9+
Implemenation of the `Storage` protocol that uses UserDefaults to store and retrieve data.
10+
- Note: UserDefaults is a simple interface for storing key-value pairs persistently across app launches.
1011

1112
## Methods
1213
### `init()`
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**EXTENSION**
2+
3+
# `AuthorizationConfiguration`
4+
```swift
5+
extension AuthorizationConfiguration
6+
```
7+
8+
## Methods
9+
### `fromPlist(_:)`
10+
11+
```swift
12+
public static func fromPlist(_ bundle: Bundle = Bundle.main) -> AuthorizationConfiguration?
13+
```
14+
15+
Creates an instance of AuthorizationConfiguration from a plist file.
16+
17+
### `getStorageFromPlist(_:)`
18+
19+
```swift
20+
public static func getStorageFromPlist(_ bundle: Bundle = Bundle.main) -> Storage?
21+
```
22+
23+
Returns the storage type from the plist file.

Documentation/Reference/extensions/AuthorizationManager.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,51 @@ extension AuthorizationManager
66
```
77

88
## Properties
9+
### `eventPublisher`
10+
11+
```swift
12+
public var eventPublisher: AnyPublisher<FusionAuthState?, Never>
13+
```
14+
15+
A publisher that emits the current FusionAuthState whenever it changes
16+
917
### `log`
1018

1119
```swift
1220
public static var log: Logger?
1321
```
1422

23+
The logger for the FusionAuth Mobile SDK
24+
1525
## Methods
26+
### `initialize(bundle:storage:)`
27+
28+
```swift
29+
@discardableResult public func initialize(bundle: Bundle = Bundle.main, storage: Storage? = nil) -> Self
30+
```
31+
32+
Initialize the AuthorizationManager with the given bundle
33+
34+
### `oauth()`
35+
36+
```swift
37+
public static func oauth() throws -> OAuthAuthorizationService
38+
```
39+
40+
Returns an instance of the OAuthAuthorizationService, configured with the current configuration
41+
42+
### `oauth()`
43+
44+
```swift
45+
public func oauth() throws -> OAuthAuthorizationService
46+
```
47+
48+
Returns an instance of the OAuthAuthorizationService, configured with the current configuration
49+
1650
### `setLogLevel(_:)`
1751

1852
```swift
1953
public static func setLogLevel(_ level: OSLogType)
2054
```
55+
56+
Set the log level for the AuthorizationManager
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
**EXTENSION**
2+
3+
# `OAuthAuthorizationService`
4+
```swift
5+
extension OAuthAuthorizationService
6+
```
7+
8+
## Methods
9+
### `authorize(options:)`
10+
11+
```swift
12+
public func authorize(options: OAuthAuthorizeOptions) async throws -> OIDAuthState
13+
```
14+
15+
Authorizes the user using OAuth authorization code flow.
16+
17+
- Parameter options: The options to configure the OAuth logout request.
18+
- Returns: The OAuth authorization state.
19+
20+
#### Parameters
21+
22+
| Name | Description |
23+
| ---- | ----------- |
24+
| options | The options to configure the OAuth logout request. |
25+
26+
### `logout(options:)`
27+
28+
```swift
29+
public func logout(options: OAuthLogoutOptions) async throws
30+
```
31+
32+
Log out the user
33+
34+
- Parameter options: The options to configure the OAuth logout request.
35+
36+
#### Parameters
37+
38+
| Name | Description |
39+
| ---- | ----------- |
40+
| options | The options to configure the OAuth logout request. |
41+
42+
### `userInfo()`
43+
44+
```swift
45+
public func userInfo() async throws -> UserInfo
46+
```
47+
48+
Retrieves the user information for the authenticated user.
49+
50+
- Returns: The user information
51+
- Throws: An error if the user information is not found.
52+
53+
### `freshAccessToken()`
54+
55+
```swift
56+
public func freshAccessToken() async throws -> String?
57+
```
58+
59+
Retrieves a fresh access token.
60+
61+
- Returns: The fresh access token or nil if an error occurs.

0 commit comments

Comments
 (0)