認可
コンテンツ・コネクタは、次のいずれかの認可モデルをサポートできます。
- 認証なし
- OAuth
- 基本
認証なし
これは、コンテンツ・コネクタが認可を必要としない場合に使用します。 この場合、コネクタ・ピッカーは、認可画面を起動せずに直接起動します。
ServerResource Implementation
serverInfo.authenticationType = AuthenticationType.NO_AUTH
OAuth
これは、コンテンツ・コネクタがOAuthをサポートしている場合に使用します。 この場合、OCMによって、アクセス・トークンをフェッチするためにOAuthフローが確実に起動されます。 以降のアクセスでは、すでにフェッチされているトークンが期限切れになるまで使用されます。
serverResource Implementation
serverInfo.authenticationType = AuthenticationType.OAUTH
コンテンツ・コネクタでは、OAuthフローで使用する必須のカスタム・フィールドも定義する必要があります。
ServerResource Implementation
{
FieldInfo field = new FieldInfo();
field.ID = UnsplashAdapter.FIELD_ID_REFRESH_TOKEN;
field.label = ResourceBundleUtil.getDefaultLocalizedString("cds.unsplash.adapter.field.refreshtoken.label");
field.labelLocalizations =
ResourceBundleUtil.getLocalizedData("cds.unsplash.adapter.field.refreshtoken.label");
field.datatype = FieldDatatype.STRING;
field.userSettable = false;
field.siteSettable = false;
field.connectorSettable = true;
field.authorizationURLParameter = false;
serverInfo.fields.add(field);
}
{
FieldInfo field = new FieldInfo();
field.ID = UnsplashAdapter.FIELD_ID_ACCESS_TOKEN;
field.label = ResourceBundleUtil.getDefaultLocalizedString("cds.unsplash.adapter.field.accesstoken.label");
field.labelLocalizations =
ResourceBundleUtil.getLocalizedData("cds.unsplash.adapter.field.accesstoken.label");
field.datatype = FieldDatatype.STRING;
field.userSettable = false;
field.siteSettable = false;
field.connectorSettable = true;
field.authorizationURLParameter = false;
serverInfo.fields.add(field);
}
{
FieldInfo field = new FieldInfo();
field.ID = UnsplashAdapter.FIELD_ID_AUTHORIZATION_URL_PARAMETER_CODE;
field.label = ResourceBundleUtil.getDefaultLocalizedString("cds.unsplash.adapter.field.authurl.code.label");
field.labelLocalizations =
ResourceBundleUtil.getLocalizedData("cds.unsplash.adapter.field.authurl.code.label");
field.datatype = FieldDatatype.STRING;
field.userSettable = false;
field.siteSettable = false;
field.connectorSettable = false;
field.authorizationURLParameter = true;
serverInfo.fields.add(field);
}
{
FieldInfo field = new FieldInfo();
field.ID = UnsplashAdapter.FIELD_ID_AUTHORIZATION_URL_PARAMETER_ERROR;
field.label =
ResourceBundleUtil.getDefaultLocalizedString("cds.unsplash.adapter.field.authurl.error.label");
field.labelLocalizations =
ResourceBundleUtil.getLocalizedData("cds.unsplash.adapter.field.authurl.error.label");
field.datatype = FieldDatatype.STRING;
field.userSettable = false;
field.siteSettable = false;
field.connectorSettable = false;
field.authorizationURLParameter = true;
serverInfo.fields.add(field);
また、前のテキストに記載されている次のインタフェースも実装しています:
-
/rest/api/v1/authorization/authorizationURLs -
/rest/api/v1/authorization/completedAuthorizations
基本
これは、コンテンツ・コネクタがバックエンドに接続するためにログイン資格証明が必要な場合に使用されます。 ここでは、OCMは初めてピッカーを起動する前にサインインの詳細を入力するよう求めます。 資格証明が使用可能な場合は、それが使用されます。
ノート:
Oracleでは、外部使用に対するBasic認可がサポートされなくなりました。ServerResource Implementation
serverInfo.authenticationType = AuthenticationType.BASICまた、サーバー実装のすべてのログイン・フィールドを定義する必要もあります。 これらのフィールドは、ログイン画面に表示されます。
// custom field for User Name
{
FieldInfo field = new FieldInfo();
field.ID = "UserName";
field.label = ResourceBundleUtil.getDefaultLocalizedString("cds.unsplash.
adapter.field.username.label");
field.labelLocalizations = ResourceBundleUtil.getLocalizedData("
cds.unsplash.adapter.field.username.label");
field.description = ResourceBundleUtil.getDefaultLocalized-
String("cds.unsplash.adapter.field.username.desc");
field.descriptionLocalizations = ResourceBundleUtil.getLocalizedData("
cds.unsplash.adapter.field.username.desc");
field.datatype = FieldDatatype.STRING;
field.userSettable = true;
field.siteSettable = false;
field.connectorSettable = false;
field.authorizationURLParameter = false;
field.required = true;
serverInfo.fields.add(field);
}
// custom field for password
{
FieldInfo field = new FieldInfo();
field.ID = "UserPwd";
field.label = ResourceBundleUtil.getDefaultLocalizedString("cds.unsplash.
adapter.field.password.label");
field.labelLocalizations = ResourceBundleUtil.getLocalizedData("
cds.unsplash.adapter.field.password.label");
field.description = ResourceBundleUtil.getDefaultLocalized-
String("cds.unsplash.adapter.field.password.desc");
field.descriptionLocalizations = ResourceBundleUtil.getLocalizedData("
cds.unsplash.adapter.field.password.desc");
field.datatype = FieldDatatype.PASSWORD;
field.userSettable = true;
field.siteSettable = false;
field.connectorSettable = false;
field.authorizationURLParameter = false;
field.required = true;
serverInfo.fields.add(field);
}これ以外に、コンテンツ・コネクタでは前述のテキストで説明したように、次のインタフェースを実装する必要があります。
/rest/api/v1/authorization/basicAuthorizationその後、ユーザー資格証明(パスワードbase64エンコード)は、ファイルシステムなどの他のコールのヘッダー経由で渡され、コンテンツが取得されます。