|
21 | 21 | import java.lang.annotation.Retention;
|
22 | 22 | import java.lang.annotation.RetentionPolicy;
|
23 | 23 | import java.lang.annotation.Target;
|
| 24 | +import java.util.List; |
24 | 25 |
|
25 | 26 | import org.springframework.core.annotation.AliasFor;
|
26 | 27 | import org.springframework.web.cors.CorsConfiguration;
|
|
77 | 78 | String[] value() default {};
|
78 | 79 |
|
79 | 80 | /**
|
80 |
| - * The list of allowed origins that be specific origins, e.g. |
81 |
| - * {@code "https://domain1.com"}, or {@code "*"} for all origins. |
82 |
| - * <p>A matched origin is listed in the {@code Access-Control-Allow-Origin} |
83 |
| - * response header of preflight actual CORS requests. |
84 |
| - * <p>By default all origins are allowed. |
85 |
| - * <p><strong>Note:</strong> CORS checks use values from "Forwarded" |
86 |
| - * (<a href="https://tools.ietf.org/html/rfc7239">RFC 7239</a>), |
87 |
| - * "X-Forwarded-Host", "X-Forwarded-Port", and "X-Forwarded-Proto" headers, |
88 |
| - * if present, in order to reflect the client-originated address. |
89 |
| - * Consider using the {@code ForwardedHeaderFilter} in order to choose from a |
90 |
| - * central place whether to extract and use, or to discard such headers. |
91 |
| - * See the Spring Framework reference for more on this filter. |
92 |
| - * @see #value |
| 81 | + * A list of origins for which cross-origin requests are allowed. Please, |
| 82 | + * see {@link CorsConfiguration#setAllowedOrigins(List)} for details. |
| 83 | + * <p>By default all origins are allowed unless {@code originPatterns} is |
| 84 | + * also set in which case {@code originPatterns} is used instead. |
93 | 85 | */
|
94 | 86 | @AliasFor("value")
|
95 | 87 | String[] origins() default {};
|
96 | 88 |
|
97 | 89 | /**
|
98 |
| - * The list of allowed origins patterns that be specific origins, e.g. |
99 |
| - * {@code ".*\.domain1\.com"}, or {@code ".*"} for matching all origins. |
100 |
| - * <p>A matched origin is listed in the {@code Access-Control-Allow-Origin} |
101 |
| - * response header of preflight actual CORS requests. |
102 |
| - * <p>By default all origins are allowed. |
103 |
| - * <p><strong>Note:</strong> CORS checks use values from "Forwarded" |
104 |
| - * (<a href="https://tools.ietf.org/html/rfc7239">RFC 7239</a>), |
105 |
| - * "X-Forwarded-Host", "X-Forwarded-Port", and "X-Forwarded-Proto" headers, |
106 |
| - * if present, in order to reflect the client-originated address. |
107 |
| - * Consider using the {@code ForwardedHeaderFilter} in order to choose from a |
108 |
| - * central place whether to extract and use, or to discard such headers. |
109 |
| - * See the Spring Framework reference for more on this filter. |
110 |
| - * @see #value |
| 90 | + * Alternative to {@link #origins()} that supports origins declared via |
| 91 | + * wildcard patterns. Please, see |
| 92 | + * @link CorsConfiguration#setAllowedOriginPatterns(List)} for details. |
| 93 | + * <p>By default this is not set. |
| 94 | + * @since 5.3 |
111 | 95 | */
|
112 | 96 | String[] originPatterns() default {};
|
113 | 97 |
|
|
0 commit comments