public void handle(Callback callback, Authentication auth) throws IOException, UnsupportedCallbackException { if (callback instanceof TextInputCallback) { TextInputCallback tic = (TextInputCallback) callback; tic.setText(auth.getPrincipal().toString()); } } }
final String defaultText = inputCallback.getDefaultText(); if (defaultText != null) { inputCallback.setText(defaultText); } else { CallbackUtil.unsupported(callback);
@Override public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (final Callback cb : callbacks) { if (cb instanceof TextInputCallback) { final TextInputCallback ticb = (TextInputCallback)cb; final String prompt = ticb.getPrompt(); log.info("Got prompt: {}", prompt); if (prompt == "clientID") { ticb.setText(clientID); } else if (prompt == "clientSecret") { ticb.setText(clientSecret); } else if (prompt == "accessToken") { ticb.setText(accessToken); } else if (prompt == "refreshToken") { ticb.setText(refreshToken); } else { throw new UnsupportedCallbackException(ticb, "Unrecognized prompt: " + ticb.getPrompt()); } } else { throw new UnsupportedCallbackException(cb, "Unsupported callback type."); } } }
@Override public void handle(final Callback callbacks[]) throws IOException, UnsupportedCallbackException { for (final Callback callback : callbacks) { if (callback instanceof NameCallback) { NameCallback.class.cast(callback).setName(username); } else if (callback instanceof TextInputCallback) { final TextInputCallback cb = TextInputCallback.class.cast(callback); if (cb.getPrompt().equals("authMethod")) { cb.setText(HttpServletRequest.CLIENT_CERT_AUTH); } else { throw new UnsupportedCallbackException(callback); } } else { throw new UnsupportedCallbackException(callback); } } } }
@Override public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (final Callback callback : callbacks) { if (callback instanceof NameCallback) { NameCallback.class.cast(callback).setName(username); } else if (callback instanceof TextInputCallback) { final TextInputCallback cb = TextInputCallback.class.cast(callback); if (cb.getPrompt().equals("authMethod")) { cb.setText(authenticationMethod); } else if (cb.getPrompt().equals("algorithm")) { cb.setText(algorithm); } else if (cb.getPrompt().equals("signature")) { cb.setText(clientSignature); } else { throw new UnsupportedCallbackException(callback); } } else { throw new UnsupportedCallbackException(callback); } } } });
tc.setText(text);
tc.setText(text);
final TextInputCallback cb = TextInputCallback.class.cast(callback); if (cb.getPrompt().equals("nonce")) { cb.setText(nonce); } else if (cb.getPrompt().equals("nc")) { cb.setText(nc); } else if (cb.getPrompt().equals("cnonce")) { cb.setText(cnonce); } else if (cb.getPrompt().equals("qop")) { cb.setText(qop); } else if (cb.getPrompt().equals("realmName")) { cb.setText(realmName); } else if (cb.getPrompt().equals("md5a2")) { cb.setText(md5a2); } else if (cb.getPrompt().equals("authMethod")) { cb.setText(HttpServletRequest.DIGEST_AUTH); } else { throw new UnsupportedCallbackException(callback);
System.out.println(tic.getPrompt()); System.out.flush(); tic.setText((new BufferedReader(new InputStreamReader(System.in))) .readLine()); } else {
System.out.println(tic.getPrompt()); System.out.flush(); tic.setText((new BufferedReader(new InputStreamReader(System.in))) .readLine()); } else {
System.out.println(tic.getPrompt()); System.out.flush(); tic.setText((new BufferedReader(new InputStreamReader(System.in))) .readLine()); } else {
TextInputCallback cb = ((TextInputCallback) callbacks[i]); if (cb.getPrompt().equals("nonce")) { cb.setText(nonce); } else if (cb.getPrompt().equals("nc")) { cb.setText(nc); } else if (cb.getPrompt().equals("cnonce")) { cb.setText(cnonce); } else if (cb.getPrompt().equals("qop")) { cb.setText(qop); } else if (cb.getPrompt().equals("realmName")) { cb.setText(realmName); } else if (cb.getPrompt().equals("md5a2")) { cb.setText(md5a2); } else if (cb.getPrompt().equals("authMethod")) { cb.setText(authMethod); } else { throw new UnsupportedCallbackException(callbacks[i]);
@Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (Callback cb : callbacks) { if (cb instanceof NameCallback) { ((NameCallback) cb).setName(passwordAuthentication.getUserName()); } else if (cb instanceof PasswordCallback) { ((PasswordCallback) cb).setPassword(passwordAuthentication.getPassword()); } else if (cb instanceof TextInputCallback) { final TextInputCallback ticb = (TextInputCallback) cb; final String prompt = ticb.getPrompt(); if (AuthenticatorType.ADMIN_INDICATOR.name().equals(prompt)) { ticb.setText(specialAdminIndicator()); } else if (AuthenticatorType.ADMIN_TOKEN.name().equals(prompt)) { ticb.setText(token()); } else if (AuthenticatorType.REMOTE_HOST.name().equals(prompt)) { ticb.setText(remoteHost()); } else if (AuthenticatorType.REST_TOKEN.name().equals(prompt)) { ticb.setText(restToken()); } else if (AuthenticatorType.REMOTE_ADDR.name().equals(prompt)) { ticb.setText(remoteAddr()); } } else if (cb instanceof AdminLoginModule.PrincipalCallback) { ((AdminLoginModule.PrincipalCallback) cb).setPrincipal(clientPrincipal); } } }
TextInputCallback cb = ((TextInputCallback) callbacks[i]); if (cb.getPrompt().equals("nonce")) { cb.setText(nonce); } else if (cb.getPrompt().equals("nc")) { cb.setText(nc); } else if (cb.getPrompt().equals("cnonce")) { cb.setText(cnonce); } else if (cb.getPrompt().equals("qop")) { cb.setText(qop); } else if (cb.getPrompt().equals("realmName")) { cb.setText(realmName); } else if (cb.getPrompt().equals("md5a2")) { cb.setText(md5a2); } else if (cb.getPrompt().equals("authMethod")) { cb.setText(authMethod); } else { throw new UnsupportedCallbackException(callbacks[i]);
TextInputCallback cb = ((TextInputCallback) callbacks[i]); if (cb.getPrompt().equals("nonce")) { cb.setText(nonce); } else if (cb.getPrompt().equals("nc")) { cb.setText(nc); } else if (cb.getPrompt().equals("cnonce")) { cb.setText(cnonce); } else if (cb.getPrompt().equals("qop")) { cb.setText(qop); } else if (cb.getPrompt().equals("realmName")) { cb.setText(realmName); } else if (cb.getPrompt().equals("md5a2")) { cb.setText(md5a2); } else if (cb.getPrompt().equals("authMethod")) { cb.setText(authMethod); } else { throw new UnsupportedCallbackException(callbacks[i]);
TextInputCallback cb = ((TextInputCallback) callbacks[i]); if (cb.getPrompt().equals("nonce")) { cb.setText(nonce); } else if (cb.getPrompt().equals("nc")) { cb.setText(nc); } else if (cb.getPrompt().equals("cnonce")) { cb.setText(cnonce); } else if (cb.getPrompt().equals("qop")) { cb.setText(qop); } else if (cb.getPrompt().equals("realmName")) { cb.setText(realmName); } else if (cb.getPrompt().equals("md5a2")) { cb.setText(md5a2); } else if (cb.getPrompt().equals("authMethod")) { cb.setText(authMethod); } else { throw new UnsupportedCallbackException(callbacks[i]);
TextInputCallback cb = ((TextInputCallback) callbacks[i]); if (cb.getPrompt().equals("nonce")) { cb.setText(nonce); } else if (cb.getPrompt().equals("nc")) { cb.setText(nc); } else if (cb.getPrompt().equals("cnonce")) { cb.setText(cnonce); } else if (cb.getPrompt().equals("qop")) { cb.setText(qop); } else if (cb.getPrompt().equals("realmName")) { cb.setText(realmName); } else if (cb.getPrompt().equals("md5a2")) { cb.setText(md5a2); } else if (cb.getPrompt().equals("authMethod")) { cb.setText(authMethod); } else if (cb.getPrompt().equals("catalinaBase")) { cb.setText(realm.getContainer().getCatalinaBase().getAbsolutePath()); } else { throw new UnsupportedCallbackException(callbacks[i]);
TextInputCallback cb = ((TextInputCallback) callbacks[i]); if (cb.getPrompt().equals("nonce")) { cb.setText(nonce); } else if (cb.getPrompt().equals("nc")) { cb.setText(nc); } else if (cb.getPrompt().equals("cnonce")) { cb.setText(cnonce); } else if (cb.getPrompt().equals("qop")) { cb.setText(qop); } else if (cb.getPrompt().equals("realmName")) { cb.setText(realmName); } else if (cb.getPrompt().equals("md5a2")) { cb.setText(md5a2); } else if (cb.getPrompt().equals("authMethod")) { cb.setText(authMethod); } else if (cb.getPrompt().equals("catalinaBase")) { cb.setText(realm.getContainer().getCatalinaBase().getAbsolutePath()); } else { throw new UnsupportedCallbackException(callbacks[i]);
((PasswordCallback)callbacks[i]).setPassword(((Text)controls[i]).getText().toCharArray()); } else if(callbacks[i] instanceof TextInputCallback) { ((TextInputCallback)callbacks[i]).setText(((Text)controls[i]).getText()); } else if(callbacks[i] instanceof ChoiceCallback) { ((ChoiceCallback)callbacks[i]).setSelectedIndex(((Combo)controls[i]).getSelectionIndex());
((PasswordCallback)callbacks[i]).setPassword(((Text)controls[i]).getText().toCharArray()); } else if(callbacks[i] instanceof TextInputCallback) { ((TextInputCallback)callbacks[i]).setText(((Text)controls[i]).getText()); } else if(callbacks[i] instanceof ChoiceCallback) { ((ChoiceCallback)callbacks[i]).setSelectedIndex(((Combo)controls[i]).getSelectionIndex());