Great suggestion! Using that approach, I will know if I should show the username/password form or not. I can assume that if I have a realm that does not support UsernamePasswordToken that it must be an Indirect realm and I should show buttons/links.
I don't think I'll be able to introspect the Indirect realm to get enough information to generate the "Login using x" buttons (I would want to change color and icons to match the provider), but I can augment that via my own configuration. Thanks! On Tue, Jun 13, 2017 at 6:00 PM, Brian Demers [via Shiro User] < [email protected]> wrote: > Cool idea! > > Take a look at the 'supports()' method https://shiro.apache. > org/static/1.3.2/apidocs/org/apache/shiro/realm/AuthenticatingRealm.html# > supports-org.apache.shiro.authc.AuthenticationToken- > > You could loop through your collection of realms and pass a Username > Password token to them. > > -Brian > > On Tue, Jun 13, 2017 at 4:36 PM, volumeint <[hidden email] > <http:///user/SendEmail.jtp?type=node&node=7581653&i=0>> wrote: > >> At runtime, I would like to query the shiro library to determine how I >> should >> prompt my users to login. If I have any "Direct" realms (jdbc, ldap), I >> would want to show a username/password form. If I have "Indirect" realms >> (oauth, cas), I would want to provide buttons for "Login using >> /external-service-x/". If shiro has been configured with both Direct and >> Indirect realms, I want my login form to show both options, buttons and a >> form. Is this possible directly from Shiro? >> >> I know how to get the list of configured Realms, but is there a way to >> determine if a realm is Direct or Indirect? I'm hoping to avoid >> someRealm.getClass().getName().equals(KNOWN_INDIRECT_REALM_IMPL). >> >> >> >> >> -- >> View this message in context: http://shiro-user.582556.n2.na >> bble.com/Query-shiro-to-build-login-form-tp7581652.html >> Sent from the Shiro User mailing list archive at Nabble.com. >> > > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > http://shiro-user.582556.n2.nabble.com/Query-shiro-to-build-login-form- > tp7581652p7581653.html > To unsubscribe from Query shiro to build login form, click here > <http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7581652&code=dGdyYW50QHZvbHVtZWludGVncmF0aW9uLmNvbXw3NTgxNjUyfDQ3NzA5MTk0Mw==> > . > NAML > <http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://shiro-user.582556.n2.nabble.com/Query-shiro-to-build-login-form-tp7581652p7581654.html Sent from the Shiro User mailing list archive at Nabble.com.
