-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AeroGear-2093 Update the Security Template app to use the IDM SDK #18
Conversation
… and replaced it with AGSAuth User model, added mobile-services file
@@ -26,9 +28,18 @@ class AppComponents { | |||
self.kcWrapper = KeychainWrapper.standard | |||
} | |||
|
|||
func resolveAuthService() -> AuthenticationService { | |||
|
|||
func resolveAuthService() -> AgsAuth { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for docs referencing, can you add asciidoc tags around this function? eg
// tag::initAuthService[]
func resolveAuthService() -> AgsAuth {
...
}
// end::initAuthService[]
do { | ||
try self.authService.login(presentingViewController: presentingViewController, onCompleted: onLoginCompleted) | ||
} catch { | ||
fatalError("Unexpected error: \(error)") | ||
} | ||
} | ||
|
||
func logout() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here:
// tag::logout[]
func logout() {
...
}
// end::logout[]
let certPinningService: CertPinningService | ||
var router: AuthenticationRouter? | ||
|
||
init(authService: AuthenticationService, certPinningService: CertPinningService) { | ||
init(authService: AgsAuth, certPinningService: CertPinningService) { | ||
self.authService = authService | ||
self.certPinningService = certPinningService | ||
} | ||
|
||
func startAuth(presentingViewController: UIViewController) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here:
// tag::login[]
func startAuth(presentingViewController: UIViewController) {
...
}
// end::login[]
@TommyJ1994 Tags have been added as requested |
|
||
let accessControlRouter = AccessControlRouterImpl(viewController: viewController) | ||
return accessControlRouter | ||
} | ||
|
||
func resolveCurrentUser() -> User? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@twnolan Can you also add a docs tag to this function. resolveCurrentUser
should be ok for naming.
@@ -49,9 +50,9 @@ class AccessControlViewController: UIViewController, UITableViewDataSource, UITa | |||
// Dispose of any resources that can be recreated. | |||
} | |||
|
|||
func highlightUserRealmRoles(identity: Identity) { | |||
func highlightUserRealmRoles(user: User) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@twnolan Also possible to have asciidoc tags for this one too? highlightUserRealmRoles
secure-ios-app/mobile-services.json
Outdated
"url": "https://www.mocky.io/v2/5a6b59fb31000088191b8ac6", | ||
"config": { | ||
"auth-server-url": "https://keycloak.security.feedhenry.org/auth", | ||
"clientId": "client-app", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@twnolan We can remove clientId
from the config
block as it's no longer included in the configuration since aerogearcatalog/keycloak-apb#66.
@TommyJ1994 @aidenkeating The code has been updated as per your requests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small comment. Looks good to me otherwise, tested on emulator and all auth/access control functions work as expected.
secure-ios-app/mobile-services.json
Outdated
@@ -0,0 +1,35 @@ | |||
{ | |||
"version": "1.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the latest aerogear-ios-sdk expects this to be a integer now rather than a String. The app crashed for me using the latest SDK with the version defined as a String.
@TommyJ1994 updated as per your recommendation |
@wei-lee @aidenkeating @TommyJ1994 This PR is fully ready now for final review and testing |
return nil | ||
} | ||
return currentUser | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can just do return authService.currentUser()
secure-ios-app/root/RootRouter.swift
Outdated
return nil | ||
} | ||
return currentUser | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the guard
statement is not required here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good. 2 small things:
- can we remove the .DS_Store file from the repo
- the
guard
request inresolveCurrentUser
method is not required.
Once these 2 things are fixed, we are good to merge.
Good job!
@wei-lee updated as requested |
Motivation:
To upgrade the ios security template application to use the Aerogear AGSAuth library.
To Test:
Build and run the application in an iOS Simulator
Work Completed: