Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion FRAuth/FRAuth/FRAuth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public final class FRAuth: NSObject {
/// OAuth2Client instance for FRAuth; OAuth2Client values are retrieved from .plist configuration file
var oAuth2Client: OAuth2Client?
/// TokenManager instance for FRAuth to perform any token related operation
var tokenManager: TokenManager?
public var tokenManager: TokenManager?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the copyright header to reflect the latest changes year

/// SessionManager instance for FRAuth to perform manage, and persist session
var sessionManager: SessionManager
/// KeychainManager instance for FRAuth to perform any keychain related operation to persist and/or retrieve credentials
Expand Down
12 changes: 8 additions & 4 deletions FRAuth/FRAuth/Manager/TokenManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ import Foundation


/// TokenManager class is a management class responsible for persisting, retrieving, and refreshing OAuth2 token(s)
struct TokenManager {
public struct TokenManager {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the copyright header to reflect the latest changes year


var oAuth2Client: OAuth2Client
public var oAuth2Client: OAuth2Client

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add code doc for the public oAuth2Client

var keychainManager: KeychainManager

/// Initializes TokenMAnager instance with optional Access Group for shared Keychain Group identifier
///
/// - Parameters:
/// - oAuth2Client: OAuth2Client instance for OAuth2 token protocols
/// - keychainManager: KeychainManager instance for secure credentials management
public init(oAuth2Client: OAuth2Client, keychainManager: KeychainManager) {
init(oAuth2Client: OAuth2Client, keychainManager: KeychainManager) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was public meant to be removed here?

self.oAuth2Client = oAuth2Client
self.keychainManager = keychainManager
}
Expand Down Expand Up @@ -357,7 +357,7 @@ struct TokenManager {


/// Clears all credentials locally as there is no more valid credentials to renew user's session
func clearCredentials() {
public func clearCredentials() {
self.keychainManager.cookieStore.deleteAll()
let _ = try? self.keychainManager.setAccessToken(token: nil)
self.keychainManager.setSSOToken(ssoToken: nil)
Expand All @@ -366,6 +366,10 @@ struct TokenManager {
Browser.currentBrowser = nil
}

public func persistToken(token: AccessToken) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add code doc for the persistToken method

let _ = try? self.keychainManager.setAccessToken(token: token)
}


/// Revoke given Access Token without using the Refresh Token
func revokeToken(_ token: AccessToken, completion: @escaping CompletionCallback) {
Expand Down