bmarwell commented on code in PR #2372: URL: https://github.com/apache/shiro/pull/2372#discussion_r2563919203
########## web/src/main/java/org/apache/shiro/web/util/CorsUtils.java: ########## @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.shiro.web.util; + +import org.apache.shiro.lang.util.StringUtils; + +import javax.servlet.http.HttpServletRequest; + +/** + * Utility class for CORS request handling based on the W3. + * + * @see <a href="https://fetch.spec.whatwg.org/#http-cors-protocol">CORS W3C recommendation</a> + * @since 2.0.7 + */ +public interface CorsUtils { + + /** + * The HTTP {@code Origin} header field name. + * @see <a href="https://tools.ietf.org/html/rfc6454">RFC 6454</a> + */ + String ORIGIN = "Origin"; + /** + * The CORS {@code Access-Control-Request-Method} request header field name. + * @see <a href="https://www.w3.org/TR/cors/">CORS W3C recommendation</a> + */ + String ACCESS_CONTROL_REQUEST_METHOD = "Access-Control-Request-Method"; + + String OPTIONS = "OPTIONS"; Review Comment: This is the only NIT I have left. Do we want to have constants in an interface? I think this is an anti-pattern. However, it does not bug me that much. Usually this goes into a `public final` utility class. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
