Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lapinek/8f802d895e3154d13f8564abf8dfcbfa to your computer and use it in GitHub Desktop.
Save lapinek/8f802d895e3154d13f8564abf8dfcbfa to your computer and use it in GitHub Desktop.
// ViewController.swift
// . . .
// MARK: Authorization methods
extension ViewController {
// . . .
/**
Authorizes the Relying Party with an OIDC Provider.
- Parameter issuerUrl: The OP's `issuer` URL to use for OpenID configuration discovery
- Parameter configuration: Ready to go OIDServiceConfiguration object populated with the OP's endpoints
- Parameter completion: (Optional) Completion handler to execute after successful authorization.
*/
func authorizeRp(issuerUrl: String?, configuration: OIDServiceConfiguration?, completion: (() -> Void)? = nil) {
/**
Performs authorization with an OIDC Provider configuration.
A nested function to complete the authorization process after the OP's configuration has became available.
- Parameter configuration: Ready to go OIDServiceConfiguration object populated with the OP's endpoints
*/
func authorize(configuration: OIDServiceConfiguration) {
print("Authorizing with configuration: \(configuration)")
self.authorizeWithWebView(
configuration: configuration,
clientId: self.clientId,
redirectionUri: self.redirectionUri
) {
// . . .
}
// . . .
}
// . . .
}
// . . .
}
// . . .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment