If we have access to <code>hawtio:type=security,area=jolokia,name=RBACDecorator</code>,
we can add RBAC information
@param result
541891
@SuppressWarnings("unchecked")
    private void tryAddRBACInfo(Map<String, Object> result) throws MBeanException, InstanceNotFoundException, ReflectionException {
        if (mBeanServer != null && mBeanServer.isRegistered(rbacDecorator)) {
            mBeanServer.invoke(rbacDecorator, "decorate", new Object[] { result }, new String[] { Map.class.getName() });
        }
    }
495768
public static void addCacheControlAndEtagToResult(Result result, String etag, ApplicationConfiguration configuration) {
        String maxAge = configuration.getWithDefault(HTTP_CACHE_CONTROL_MAX_AGE,
                HTTP_CACHE_CONTROL_DEFAULT);

        if ("0".equals(maxAge)) {
            result.with(HeaderNames.CACHE_CONTROL, "no-cache");
        } else {
            result.with(HeaderNames.CACHE_CONTROL, "max-age=" + maxAge);
        }

        // Use etag on demand:
        boolean useEtag = configuration.getBooleanWithDefault(HTTP_USE_ETAG,
                HTTP_USE_ETAG_DEFAULT);

        if (useEtag) {
            result.with(HeaderNames.ETAG, etag);
        }
    }
327263
public boolean validateSignature(final Pair<Assertion, WsFederationConfiguration> resultPair) {
        if (resultPair == null) {
            LOGGER.warn("No assertion or its configuration was provided to validate signatures");
            return false;
        }
        val configuration = resultPair.getValue();
        val assertion = resultPair.getKey();

        if (assertion == null || configuration == null) {
            LOGGER.warn("No signature or configuration was provided to validate signatures");
            return false;
        }
        val signature = assertion.getSignature();
        if (signature == null) {
            LOGGER.warn("No signature is attached to the assertion to validate");
            return false;
        }

        try {
            LOGGER.debug("Validating the signature...");
            val validator = new SAMLSignatureProfileValidator();
            validator.validate(signature);

            val criteriaSet = new CriteriaSet();
            criteriaSet.add(new UsageCriterion(UsageType.SIGNING));
            criteriaSet.add(new EntityRoleCriterion(IDPSSODescriptor.DEFAULT_ELEMENT_NAME));
            criteriaSet.add(new ProtocolCriterion(SAMLConstants.SAML20P_NS));
            criteriaSet.add(new EntityIdCriterion(configuration.getIdentityProviderIdentifier()));
            try {
                val engine = buildSignatureTrustEngine(configuration);
                LOGGER.debug("Validating signature via trust engine for [{}]", configuration.getIdentityProviderIdentifier());
                return engine.validate(signature, criteriaSet);
            } catch (final SecurityException e) {
                LOGGER.warn(e.getMessage(), e);
            }
        } catch (final SignatureException e) {
            LOGGER.error("Failed to validate assertion signature", e);
        }

        SamlUtils.logSamlObject(this.configBean, assertion);

        LOGGER.error("Signature doesn't match any signing credential and cannot be validated.");
        return false;
    }
923728
public void requestProcessed (Object result)
    {
        @SuppressWarnings("unchecked") V value = (V)result;
        _sync.innerSet(value);
    }
436097
@SuppressWarnings(value = "unchecked cast")
    public <Result> Result call(TDApiRequest apiRequest, Optional<String> apiKeyCache, final JavaType resultType)
            throws TDClientException
    {
        try {
            byte[] content = submitRequest(apiRequest, apiKeyCache, byteArrayContentHandler);
            if (logger.isTraceEnabled()) {
                logger.trace("response:\n{}", new String(content, StandardCharsets.UTF_8));
            }
            if (resultType.getRawClass() == String.class) {
                return (Result) new String(content, StandardCharsets.UTF_8);
            }
            else {
                return getJsonReader(resultType).readValue(content);
            }
        }
        catch (JsonMappingException e) {
            logger.error("Jackson mapping error", e);
            throw new TDClientException(INVALID_JSON_RESPONSE, e);
        }
        catch (IOException e) {
            throw new TDClientException(INVALID_JSON_RESPONSE, e);
        }
    }
606625
void extractKeys(HashMap<String, String> result) {
        boolean foundChanges = false;

        try {
            log.debug("extracting public institute keys from results");

            for (int i = 0; i < 3; i++) {
                String head = HBCIUtils.withCounter("SendPubKey", i);
                String keyType = result.get(head + ".KeyName.keytype");
                if (keyType == null)
                    continue;

                String keyCountry = result.get(head + ".KeyName.KIK.country");
                String keyBLZ = result.get(head + ".KeyName.KIK.blz");
                String keyUserId = result.get(head + ".KeyName.userid");
                String keyNum = result.get(head + ".KeyName.keynum");
                String keyVersion = result.get(head + ".KeyName.keyversion");

                log.info("found key " +
                    keyCountry + "_" + keyBLZ + "_" + keyUserId + "_" + keyType + "_" +
                    keyNum + "_" + keyVersion);

                byte[] keyExponent = result.get(head + ".PubKey.exponent").getBytes(CommPinTan.ENCODING);
                byte[] keyModulus = result.get(head + ".PubKey.modulus").getBytes(CommPinTan.ENCODING);

                KeyFactory fac = KeyFactory.getInstance("RSA");
                KeySpec spec = new RSAPublicKeySpec(new BigInteger(+1, keyModulus),
                    new BigInteger(+1, keyExponent));
                Key key = fac.generatePublic(spec);

                if (keyType.equals("S")) {
                    passport.setInstSigKey(new HBCIKey(keyCountry, keyBLZ, keyUserId, keyNum, keyVersion, key));
                    foundChanges = true;
                } else if (keyType.equals("V")) {
                    passport.setInstEncKey(new HBCIKey(keyCountry, keyBLZ, keyUserId, keyNum, keyVersion, key));
                    foundChanges = true;
                }
            }
        } catch (Exception e) {
            String msg = HBCIUtils.getLocMsg("EXCMSG_EXTR_IKEYS_ERR");
            throw new HBCI_Exception(msg, e);
        }

        if (foundChanges) {
            passport.getCallback().status(HBCICallback.STATUS_INST_GET_KEYS_DONE, null);
        }
    }
336199
protected AuthenticationHandlerExecutionResult createAuthenticatedSubjectResult(final Credential credential, final Subject currentUser) {
        val username = currentUser.getPrincipal().toString();
        return createHandlerResult(credential, this.principalFactory.createPrincipal(username));
    }
680672
public static void addRetSuccessors(List<Jsr> jsrs, int idx, IntCollection result) {
        int i, max;

        max = jsrs.size();
        for (i = 0; i < max; i++) {
            ((Jsr) jsrs.get(i)).addRetSuccessors(idx, result);
        }
    }
1295083
@Override
  public ProductParsedResult parse(Result result) {
    BarcodeFormat format = result.getBarcodeFormat();
    if (!(format == BarcodeFormat.UPC_A || format == BarcodeFormat.UPC_E ||
          format == BarcodeFormat.EAN_8 || format == BarcodeFormat.EAN_13)) {
      return null;
    }
    String rawText = getMassagedText(result);
    if (!isStringOfDigits(rawText, rawText.length())) {
      return null;
    }
    // Not actually checking the checksum again here    

    String normalizedProductID;
    // Expand UPC-E for purposes of searching
    if (format == BarcodeFormat.UPC_E && rawText.length() == 8) {
      normalizedProductID = UPCEReader.convertUPCEtoUPCA(rawText);
    } else {
      normalizedProductID = rawText;
    }

    return new ProductParsedResult(rawText, normalizedProductID);
  }
1254041
function (error, result) {
    // If the login method returns its result but the connection is lost
    // before the data is in the local cache, it'll set an onReconnect (see
    // above). The onReconnect will try to log in using the token, and *it*
    // will call userCallback via its own version of this
    // loggedInAndDataReadyCallback. So we don't have to do anything here.
    if (reconnected)
      return;

    // Note that we need to call this even if _suppressLoggingIn is true,
    // because it could be matching a _setLoggingIn(true) from a
    // half-completed pre-reconnect login method.
    Accounts._setLoggingIn(false);
    if (error || !result) {
      error = error || new Error(
        "No result from call to " + options.methodName);
      onceUserCallback(error);
      return;
    }
    try {
      options.validateResult(result);
    } catch (e) {
      onceUserCallback(e);
      return;
    }

    // Make the client logged in. (The user data should already be loaded!)
    makeClientLoggedIn(result.id, result.token, result.tokenExpires);
    onceUserCallback();
  }
715388
void onSignOutResult(int rstCode, SignOutResult result) {
        HMSAgentLog.i("signOut:callback=" + StrUtils.objDesc(handler) +" retCode=" + rstCode);
        if (handler != null) {
            new Handler(Looper.getMainLooper()).post(new CallbackResultRunnable<SignOutResult>(handler, rstCode, result));
            handler = null;
        }
        retryTimes = MAX_RETRY_TIMES;
    }
1122526
public void validationResultsChanged(ValidationResults results) {
		if (resultsModel.getMessageCount() == 0) {
			messageReceiver.setMessage(null);
		}
		else {
			ValidationMessage message = getValidationMessage(resultsModel);
			messageReceiver.setMessage(message);
		}
	}
1015731
private void disposeObtainedResult(SignInResult result, int rstCode) {
        if(result.isSuccess()){
            //可以获取帐号的 openid，昵称，头像 at信息
            SignInHuaweiId account = result.getSignInHuaweiId();
            onSignInResult(rstCode, account);
        } else {
            if(rstCode == HuaweiIdStatusCodes.SIGN_IN_UNLOGIN
                    || rstCode == HuaweiIdStatusCodes.SIGN_IN_AUTH
                    || rstCode == HuaweiIdStatusCodes.SIGN_IN_CHECK_PASSWORD){
                Activity curActivity = ActivityMgr.INST.getLastActivity();
                if (curActivity == null) {
                    HMSAgentLog.e("activity is null");
                    onSignInResult(HMSAgent.AgentResultCode.NO_ACTIVITY_FOR_USE, null);
                    return;
                }

                try {
                    signInResultForDispose = result;
                    Intent nxtIntent = new Intent(curActivity, HMSSignInAgentActivity.class);
                    curActivity.startActivity(nxtIntent);
                } catch (Exception e) {
                    HMSAgentLog.e("start HMSSignInAgentActivity error:" + e.getMessage());
                    onSignInResult(HMSAgent.AgentResultCode.START_ACTIVITY_ERROR, null);
                }
            } else {
                onSignInResult(rstCode, null);
            }
        }
    }
854207
@Override
    @FFDCIgnore({ com.ibm.ws.security.authentication.AuthenticationException.class })
    public AuthenticationResult authenticate(HttpServletRequest request,
                                             HttpServletResponse response,
                                             HashMap<String, Object> props) throws Exception {
        WebRequest webRequest = new WebRequestImpl(request, response, ((WebAppConfig) props.get("webAppConfig")).getApplicationName(), null, (SecurityMetadata) props.get("securityMetadata"), null, (WebAppSecurityConfig) props.get("webAppSecurityConfig"));
        JaspiRequest jaspiRequest = new JaspiRequest(webRequest, (WebAppConfig) props.get("webAppConfig"));
        AuthenticationResult result = null;
        AuthConfigProvider provider = getAuthConfigProvider(jaspiRequest.getAppContext());
        if (provider != null) {
            try {
                if (jaspiRequest.getWebSecurityContext() != null) {
                    JaspiAuthContext jaspiContext = getJaspiAuthContext(jaspiRequest, provider);
                    webRequest.getWebSecurityContext().setJaspiAuthContext(jaspiContext);
                }
                result = authenticate(new Subject(),
                                      getJaspiAuthType(jaspiRequest),
                                      jaspiRequest,
                                      provider);

            } catch (AuthenticationException e) {
                if (tc.isDebugEnabled())
                    Tr.debug(tc, "Internal error during JASPI authentication", e);
                result = new AuthenticationResult(AuthResult.FAILURE, e.getMessage());

            }
        } else {
            result = new AuthenticationResult(AuthResult.CONTINUE, "No JASPI provider found for request: " + request.getRequestURI());

        }
        return result;
    }
411556
protected void addParameters(StringBuilder result) {
        result.append("ts=");
        result.append(timestamp);
        result.append(",headers=");
        result.append(headers);
        result.append(",body=");
        result.append(body);
        result.append(",messageId=");
        result.append(messageId);
        result.append(",timeToLive=");
        result.append(timeToLive);
        result.append(",clientId=");
        result.append(clientId);
        result.append(",destination=");
        result.append(destination);
    }
807894
public void returnToResultPool(Result result) {
        if (result != null) {
            result.reset();
            resultPool.add(result);
        }
    }
414199
protected Map getDeviceTokenResponseModel(final OAuth20AccessTokenResponseResult result) {
        val model = new LinkedHashMap<String, Object>();
        val uri = result.getCasProperties().getServer().getPrefix()
            .concat(OAuth20Constants.BASE_OAUTH20_URL)
            .concat("/")
            .concat(OAuth20Constants.DEVICE_AUTHZ_URL);
        model.put(OAuth20Constants.DEVICE_VERIFICATION_URI, uri);
        model.put(OAuth20Constants.EXPIRES_IN, result.getDeviceTokenTimeout());
        val generatedToken = result.getGeneratedToken();
        generatedToken.getUserCode().ifPresent(c -> model.put(OAuth20Constants.DEVICE_USER_CODE, c));
        generatedToken.getDeviceCode().ifPresent(c -> model.put(OAuth20Constants.DEVICE_CODE, c));
        model.put(OAuth20Constants.DEVICE_INTERVAL, result.getDeviceRefreshInterval());
        return model;
    }