protected byte[] getRememberedSerializedIdentity(SubjectContext subjectContext) {

        if (!WebUtils.isHttp(subjectContext)) {
            if (LOGGER.isDebugEnabled()) {
                String msg = "SubjectContext argument is not an HTTP-aware instance.  This is required to obtain a "
                        + "servlet request and response in order to retrieve the rememberMe cookie. Returning "
                        + "immediately and ignoring rememberMe operation.";
                LOGGER.debug(msg);
            }
            return null;
        }

        WebSubjectContext wsc = (WebSubjectContext) subjectContext;
        if (isIdentityRemoved(wsc)) {
            return null;
        }

        HttpServletRequest request = WebUtils.getHttpRequest(wsc);
        HttpServletResponse response = WebUtils.getHttpResponse(wsc);

        String base64 = getCookie().readValue(request, response);
        // Browsers do not always remove cookies immediately (SHIRO-183)
        // ignore cookies that are scheduled for removal
        if (Cookie.DELETED_COOKIE_VALUE.equals(base64)) {
            return null;
        }

        if (base64 != null) {
            base64 = ensurePadding(base64);
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace("Acquired Base64 encoded identity [" + base64 + "]");
            }
            byte[] decoded;
            try {
                decoded = Base64.decode(base64);
            } catch (RuntimeException rtEx) {
                /*
                 * https://issues.apache.org/jira/browse/SHIRO-766:
                 * If the base64 string cannot be decoded, just assume there is no valid cookie value.
                 * */
                getCookie().removeFrom(request, response);
                LOGGER.warn("Unable to decode existing base64 encoded entity: [" + base64 + "].", rtEx);
                return null;
            }

            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace("Base64 decoded byte array length: " + decoded.length + " bytes.");
            }
            return decoded;
        } else {
            //no cookie set - new site visitor?
            return null;
        }
    }
Returns a previously serialized identity byte array or {@code null} if the byte array could not be acquired.
This implementation retrieves an HTTP cookie, Base64-decodes the cookie value, and returns the resulting byte
array.
<p/>
The {@code SubjectContext} instance is expected to be a {@link WebSubjectContext} instance with an HTTP
Request/Response pair so an HTTP cookie can be retrieved from the incoming request.  If it is not a
{@code WebSubjectContext} or that {@code WebSubjectContext} does not have an HTTP Request/Response pair, this
implementation returns {@code null}.

@param subjectContext the contextual data, usually provided by a {@link Subject.Builder} implementation, that
                      is being used to construct a {@link Subject} instance.  To be used to assist with data
                      lookup.
@return a previously serialized identity byte array or {@code null} if the byte array could not be acquired.
web/src/main/java/org/apache/shiro/web/mgt/CookieRememberMeManager.java