Java Code Examples for javax.security.auth.callback.TextOutputCallback#WARNING
The following examples show how to use
javax.security.auth.callback.TextOutputCallback#WARNING .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultCallbackHandler.java From Bats with Apache License 2.0 | 6 votes |
protected void processCallback(Callback callback) throws IOException, UnsupportedCallbackException { if (callback instanceof NameCallback) { NameCallback namecb = (NameCallback)callback; namecb.setName(context.getValue(SecurityContext.USER_NAME)); } else if (callback instanceof PasswordCallback) { PasswordCallback passcb = (PasswordCallback)callback; passcb.setPassword(context.getValue(SecurityContext.PASSWORD)); } else if (callback instanceof RealmCallback) { RealmCallback realmcb = (RealmCallback)callback; realmcb.setText(context.getValue(SecurityContext.REALM)); } else if (callback instanceof TextOutputCallback) { TextOutputCallback textcb = (TextOutputCallback)callback; if (textcb.getMessageType() == TextOutputCallback.INFORMATION) { logger.info(textcb.getMessage()); } else if (textcb.getMessageType() == TextOutputCallback.WARNING) { logger.warn(textcb.getMessage()); } else if (textcb.getMessageType() == TextOutputCallback.ERROR) { logger.error(textcb.getMessage()); } else { logger.debug("Auth message type {}, message {}", textcb.getMessageType(), textcb.getMessage()); } } else { throw new UnsupportedCallbackException(callback); } }
Example 2
Source File: UpnPwdCallbackHandler.java From MyVirtualDirectory with Apache License 2.0 | 6 votes |
@Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (Callback callback : callbacks) { if (callback instanceof TextOutputCallback) { TextOutputCallback tc = (TextOutputCallback) callback; switch (tc.getMessageType()) { case TextOutputCallback.INFORMATION: logger.info(tc.getMessage()); break; case TextOutputCallback.ERROR: logger.error(tc.getMessage()); break; case TextOutputCallback.WARNING: logger.warn(tc.getMessage()); break; } } else if (callback instanceof NameCallback) { NameCallback nc = (NameCallback) callback; nc.setName(upn); } else if (callback instanceof PasswordCallback) { PasswordCallback pc = (PasswordCallback) callback; pc.setPassword(this.password.toCharArray()); } } }
Example 3
Source File: DefaultCallbackHandler.java From attic-apex-core with Apache License 2.0 | 6 votes |
protected void processCallback(Callback callback) throws IOException, UnsupportedCallbackException { if (callback instanceof NameCallback) { NameCallback namecb = (NameCallback)callback; namecb.setName(context.getValue(SecurityContext.USER_NAME)); } else if (callback instanceof PasswordCallback) { PasswordCallback passcb = (PasswordCallback)callback; passcb.setPassword(context.getValue(SecurityContext.PASSWORD)); } else if (callback instanceof RealmCallback) { RealmCallback realmcb = (RealmCallback)callback; realmcb.setText(context.getValue(SecurityContext.REALM)); } else if (callback instanceof TextOutputCallback) { TextOutputCallback textcb = (TextOutputCallback)callback; if (textcb.getMessageType() == TextOutputCallback.INFORMATION) { logger.info(textcb.getMessage()); } else if (textcb.getMessageType() == TextOutputCallback.WARNING) { logger.warn(textcb.getMessage()); } else if (textcb.getMessageType() == TextOutputCallback.ERROR) { logger.error(textcb.getMessage()); } else { logger.debug("Auth message type {}, message {}", textcb.getMessageType(), textcb.getMessage()); } } else { throw new UnsupportedCallbackException(callback); } }