public class CorsRegistration extends ObjectSE
CorsConfiguration
インスタンスの作成を支援します。CorsConfiguration
, CorsRegistry
コンストラクターと説明 |
---|
CorsRegistration(StringSE pathPattern) |
修飾子と型 | メソッドと説明 |
---|---|
CorsRegistration | allowCredentials(boolean allowCredentials) ブラウザーが、ドメイン間リクエストとともに Cookie などの資格情報をアノテーション付きエンドポイントに送信するかどうか。 |
CorsRegistration | allowedHeaders(StringSE... headers) プリフライトリクエストが実際のリクエスト中に使用できるようにリストできるヘッダーのリストを設定します。 |
CorsRegistration | allowedMethods(StringSE... methods) 許可する HTTP メソッドを設定します。 |
CorsRegistration | allowedOriginPatterns(StringSE... patterns) ブラウザーからのクロスオリジンリクエストが許可されるオリジンを指定するためのより柔軟なパターンをサポートする allowedOrigins(String...) の代替。 |
CorsRegistration | allowedOrigins(StringSE... origins) ブラウザーからのクロスオリジンリクエストを許可するオリジンを設定します。 |
CorsRegistration | combine(CorsConfiguration other) 指定された CorsConfiguration を、CorsConfiguration.applyPermitDefaultValues() で初期化された CorsConfiguration.combine(CorsConfiguration) を介して構成されているものに適用します。 |
CorsRegistration | exposedHeaders(StringSE... headers) 「単純な」ヘッダー以外のレスポンスヘッダーのリストを設定します。 |
protected CorsConfiguration | getCorsConfiguration() |
protected StringSE | getPathPattern() |
CorsRegistration | maxAge(long maxAge) プリフライトリクエストからのレスポンスをクライアントがキャッシュできる時間を秒単位で構成します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
public CorsRegistration(StringSE pathPattern)
public CorsRegistration allowedOrigins(StringSE... origins)
CorsConfiguration.setAllowedOrigins(List)
を参照してください。 デフォルトでは、すべてのオリジンが許可されますが、allowedOriginPatterns
も設定されている場合は、それが優先されます。
public CorsRegistration allowedOriginPatterns(StringSE... patterns)
allowedOrigins(String...)
の代替。フォーマットの詳細やその他の考慮事項については、CorsConfiguration.setAllowedOriginPatterns(List)
を参照してください。デフォルトでは、これは設定されていません。
public CorsRegistration allowedMethods(StringSE... methods)
"GET"
、"POST"
など。 特別な値 "*"
はすべてのメソッドを許可します。
デフォルトでは、「単純な」メソッド GET
、HEAD
、POST
が許可されています。
public CorsRegistration allowedHeaders(StringSE... headers)
特別な値 "*"
を使用して、すべてのヘッダーを許可できます。
CORS 仕様に従って、Cache-Control
、Content-Language
、Expires
、Last-Modified
または Pragma
のいずれかである場合、ヘッダー名をリストする必要はありません。
デフォルトでは、すべてのヘッダーが許可されています。
public CorsRegistration exposedHeaders(StringSE... headers)
Cache-Control
、Content-Language
、Content-Type
、Expires
、Last-Modified
または Pragma
で、実際のレスポンスが持つ可能性があり、公開することができます。 特別な値 "*"
を使用すると、資格情報のないリクエストに対してすべてのヘッダーを公開できます。
デフォルトでは、これは設定されていません。
public CorsRegistration allowCredentials(boolean allowCredentials)
Access-Control-Allow-Credentials
レスポンスヘッダーに設定されます。注意 : このオプションは、構成されたドメインとの高レベルの信頼を確立し、Cookie や CSRF トークンなどのユーザー固有の機密情報を公開することにより、Web アプリケーションの表面攻撃を増やすことに注意してください。
デフォルトでは、これは設定されていません。その場合、Access-Control-Allow-Credentials
ヘッダーも設定されないため、資格情報は許可されません。
public CorsRegistration maxAge(long maxAge)
デフォルトでは、1800 秒(30 分)に設定されています。
public CorsRegistration combine(CorsConfiguration other)
CorsConfiguration
を、CorsConfiguration.applyPermitDefaultValues()
で初期化された CorsConfiguration.combine(CorsConfiguration)
を介して構成されているものに適用します。other
- 適用する構成 protected StringSE getPathPattern()
protected CorsConfiguration getCorsConfiguration()