Comments (3)
@mfulgo Thanks! this is a great place for that discussion. This thought had crossed my mind, but I wasn't sure how developers would prefer to consume it. My preference would be returning void
with the handler as an argument. Though your suggestion above is nice too.
Neither of these options require the method to be async, it all depends on how the method is called. This lib could be used in a CLI or a webapp.
What type of application were you thinking about using this lib with?
Great feed back, thanks!
from okta-auth-java.
@bdemers Perfect. So, in my particular use case, I'm implementing a proxy/broker. For me, the problem with the handler is that it actually gets in the way of returning a response, but a void return would be worse.
var response: AuthenticationResponse = null
val handler = new AuthenticationStateHandlerAdapter {
override def handleUnknown(authResp: AuthenticationResponse) = {
response = tweakAuthResponse(authResp)
}
}
client.authenticate(user, pass, relayState) // Assuming it returns void
ok(response)
However, if it returns the AuthenticationResponse
, it simplifies quite a bit:
val authResp = client.authenticate(user, pass, relayState)
val response = tweakAuthResponse(authResp)
ok(response)
// Or just...
ok(tweakAuthResponse(client.authenticate(user, pass, relayState)))
This gets a little more complicated when dealing with Futures and thread pools, but I think the second approach gives you more control over that as well. (i.e. What context is executing the http request vs handling the response. If the client methods take in the handler, the only option is to have the client thread execute the handler methods.)
from okta-auth-java.
Thanks @mfulgo great examples and points! I'll chew this over a bit more.
from okta-auth-java.
Related Issues (20)
- Unable to use "correctAnswer" from AuthenticationResponse. HOT 17
- unable to find API to send MFA Enroll activation link via email/sms HOT 3
- Error while updating Plaid SDK 3.5.0 (Duplicate class org.bouncycastle.LICENSE) HOT 3
- Missing nullability annotations in AuthenticationStateHandler HOT 3
- is:issue is:open Okta authentication crashes, maybe okhttp library compatibility. HOT 4
- HttpClientConfiguration.getRequestExecutorParams() deprecated
- AuthenticationException localizedMessages do not adhere to Android device locale settings HOT 1
- authenticationClient.authenticate() does not return locked_out status HOT 1
- 2.0.5 dependencies result in build error HOT 2
- Resend OTP after 5 minutes - MFA. HOT 4
- enrollFactor method HOT 12
- DefaultAuthenticationClient.translateException() should be able to handle null errorCode HOT 2
- Failed resolution of: Ljava/time/format/DateTimeFormatter on Android 7 devices HOT 6
- Getting NoClassDefFound for BaseClient.java while using okta-authn-sdk-api:2.0.9 with okta-sdk-api:10.0.0 HOT 4
- Upgrade dependency okta-sdk-java version HOT 7
- Security vulnerability via transitive `dependencybcprov-jdk18on:1.75` HOT 3
- forgot password with trusted application HOT 9
- Primary authentication with trusted application not supported by SDK HOT 4
- Authentication Client Verify Factor throws Resource Exception instead of AuthenticationException HOT 4
- Incorrect key while retrieving correct answer from EmbeddedResponse HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from okta-auth-java.