public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { boolean foundCallback = false; Callback firstUnknown = null; int count = callbacks != null ? callbacks.length : 0; for(int n = 0; n < count; n ++) { Callback c = callbacks[n]; if( c instanceof MapCallback ) { MapCallback mc = (MapCallback) c; mc.setInfo(RFC2617Digest.USERNAME, username); mc.setInfo(RFC2617Digest.CNONCE, cnonce); mc.setInfo(RFC2617Digest.NONCE, nonce); mc.setInfo(RFC2617Digest.NONCE_COUNT, nc); mc.setInfo(RFC2617Digest.QOP, qop); mc.setInfo(RFC2617Digest.REALM, realm); mc.setInfo(RFC2617Digest.A2HASH, md5a2); foundCallback = true; } else if( firstUnknown == null ) { firstUnknown = c; } } if( foundCallback == false ) throw new UnsupportedCallbackException(firstUnknown, "Unrecognized Callback"); } }
private synchronized void buildGoogleApiClient() { mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(new MapCallback()) .addOnConnectionFailedListener(new FailedCallback()) .addApi(LocationServices.API) .build(); }
public void preDigest(MessageDigest digest) { try { String nonce = (String) info.getInfo(NONCE); if (nonce != null) { Boolean decodeNonce = (Boolean) info.getInfo(DECODE_NONCE); byte[] nonceBytes = decodeNonce ? Base64.getDecoder().decode(nonce) : nonce.getBytes("UTF-8"); digest.update(nonceBytes); } String created = (String) info.getInfo(CREATED); if (created != null) digest.update(created.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { throw new SecurityException(e); } }
public void postDigest(MessageDigest digest) { String qop = (String) info.getInfo(QOP); String realm = (String) info.getInfo(REALM); String algorithm = (String) info.getInfo(ALGORITHM); String nonce = (String) info.getInfo(NONCE); String cnonce = (String) info.getInfo(CNONCE); String method = (String) info.getInfo(METHOD); String nc = (String) info.getInfo(NONCE_COUNT); String digestURI = (String) info.getInfo(DIGEST_URI); String hA2 = (String) info.getInfo(A2HASH); if (hA2 == null) {
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { boolean foundCallback = false; Callback firstUnknown = null; int count = callbacks != null ? callbacks.length : 0; for (int n = 0; n < count; n++) { Callback c = callbacks[n]; if (c instanceof MapCallback) { MapCallback mc = (MapCallback) c; mc.setInfo(RFC2617Digest.USERNAME, username); mc.setInfo(RFC2617Digest.CNONCE, cnonce); mc.setInfo(RFC2617Digest.NONCE, nonce); mc.setInfo(RFC2617Digest.NONCE_COUNT, nc); mc.setInfo(RFC2617Digest.QOP, qop); mc.setInfo(RFC2617Digest.REALM, realm); mc.setInfo(RFC2617Digest.A2HASH, md5a2); foundCallback = true; } else if (firstUnknown == null) { firstUnknown = c; } } if (foundCallback == false) throw PicketBoxMessages.MESSAGES.unableToHandleCallback(firstUnknown, this.getClass().getName(), firstUnknown.getClass().getCanonicalName()); } }
public void init(Map<String,Object> options) { // Ask for MapCallback to obtain the digest parameters info = new MapCallback(); Callback[] callbacks = {info}; options.put("callbacks", callbacks); }
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { boolean foundCallback = false; Callback firstUnknown = null; int count = callbacks != null ? callbacks.length : 0; for (int n = 0; n < count; n++) { Callback c = callbacks[n]; if (c instanceof MapCallback) { //set parameters to the MapCallback the UsernameTokenCallback //created and set up in the init method MapCallback mc = (MapCallback) c; mc.setInfo(UsernameTokenCallback.NONCE, nonce); mc.setInfo(UsernameTokenCallback.CREATED, created); mc.setInfo(UsernameTokenCallback.DECODE_NONCE, Boolean.valueOf(decodeNonce)); foundCallback = true; } else if (firstUnknown == null) { firstUnknown = c; } } if (foundCallback == false) throw new UnsupportedCallbackException(firstUnknown, "Unrecognized Callback"); }
@SuppressWarnings({ "unchecked", "rawtypes" }) public void init(Map options) { username = (String) options.get("javax.security.auth.login.name"); password = (String) options.get("javax.security.auth.login.password"); String flag = (String) options.get("passwordIsA1Hash"); if (flag != null) passwordIsA1Hash = Boolean.valueOf(flag).booleanValue(); // Ask for MapCallback to obtain the digest parameters info = new MapCallback(); Callback[] callbacks = { info }; options.put("callbacks", callbacks); }
if(key instanceof String == false) throw new SecurityException("key is not a String"); mc.setInfo((String)key, keyValuePair.get(key));
mc.setInfo(key, keyValuePair.get(key));