-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
As specified in: https://fedidcg.github.io/FedCM/#automation Currently implemented in Chromium.
- Loading branch information
1 parent
edb838b
commit 0313944
Showing
7 changed files
with
225 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
...g/openqa/selenium/federatedcredentialmanagement/FederatedCredentialManagementAccount.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// Licensed to the Software Freedom Conservancy (SFC) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The SFC 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.openqa.selenium.federatedcredentialmanagement; | ||
|
||
import java.util.Map; | ||
|
||
public class FederatedCredentialManagementAccount { | ||
private final String accountId; | ||
private final String email; | ||
private final String name; | ||
private final String givenName; | ||
private final String pictureUrl; | ||
private final String idpConfigUrl; | ||
private final String loginState; | ||
private final String termsOfServiceUrl; | ||
private final String privacyPolicyUrl; | ||
|
||
public static final String LOGIN_STATE_SIGNIN = "SignIn"; | ||
public static final String LOGIN_STATE_SIGNUP = "SignUp"; | ||
|
||
public FederatedCredentialManagementAccount(Map<String, String> dict) { | ||
accountId = (String) dict.getOrDefault("accountId", null); | ||
email = (String) dict.getOrDefault("email", null); | ||
name = (String) dict.getOrDefault("name", null); | ||
givenName = (String) dict.getOrDefault("givenName", null); | ||
pictureUrl = (String) dict.getOrDefault("pictureUrl", null); | ||
idpConfigUrl = (String) dict.getOrDefault("idpConfigUrl", null); | ||
loginState = (String) dict.getOrDefault("loginState", null); | ||
termsOfServiceUrl = (String) dict.getOrDefault("termsOfServiceUrl", null); | ||
privacyPolicyUrl = (String) dict.getOrDefault("privacyPolicyUrl", null); | ||
} | ||
|
||
public String getAccountid() { | ||
return accountId; | ||
} | ||
|
||
public String getEmail() { | ||
return email; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getGivenName() { | ||
return givenName; | ||
} | ||
|
||
public String getPictureUrl() { | ||
return pictureUrl; | ||
} | ||
|
||
public String getIdpConfigUrl() { | ||
return idpConfigUrl; | ||
} | ||
|
||
public String getLoginState() { | ||
return loginState; | ||
} | ||
|
||
public String getTermsOfServiceUrl() { | ||
return termsOfServiceUrl; | ||
} | ||
|
||
public String getPrivacyPolicyUrl() { | ||
return privacyPolicyUrl; | ||
} | ||
}; |
38 changes: 38 additions & 0 deletions
38
...rg/openqa/selenium/federatedcredentialmanagement/FederatedCredentialManagementDialog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Licensed to the Software Freedom Conservancy (SFC) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The SFC 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.openqa.selenium.federatedcredentialmanagement; | ||
|
||
import java.util.List; | ||
|
||
public interface FederatedCredentialManagementDialog { | ||
|
||
String DIALOG_TYPE_ACCOUNT_LIST = "AccountChooser"; | ||
String DIALOG_TYPE_AUTH_REAUTH = "AutoReauthn"; | ||
|
||
void cancelDialog(); | ||
|
||
void selectAccount(int index); | ||
|
||
String getDialogType(); | ||
|
||
String getTitle(); | ||
|
||
String getSubtitle(); | ||
|
||
List<FederatedCredentialManagementAccount> getAccounts(); | ||
} |
41 changes: 41 additions & 0 deletions
41
...c/org/openqa/selenium/federatedcredentialmanagement/HasFederatedCredentialManagement.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Licensed to the Software Freedom Conservancy (SFC) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The SFC 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.openqa.selenium.federatedcredentialmanagement; | ||
|
||
import org.openqa.selenium.Beta; | ||
|
||
/** | ||
* Used by classes to indicate that they can interact with FedCM dialogs. | ||
*/ | ||
@Beta | ||
public interface HasFederatedCredentialManagement { | ||
// FedCM by default delays promise resolution in failure cases for privacy | ||
// reasons (https://fedidcg.github.io/FedCM/#ref-for-setdelayenabled); | ||
// this function allows turning it off to let tests run faster where this | ||
// is not relevant. | ||
void setDelayEnabled(boolean enabled); | ||
|
||
// If a user agent triggers a cooldown when the account chooser is dismissed, | ||
// this function resets that cooldown so that the dialog can be triggered | ||
// again immediately. | ||
void resetCooldown(); | ||
|
||
// Gets the currently open FedCM dialog, or null if there is no dialog. | ||
FederatedCredentialManagementDialog getFederatedCredentialManagementDialog(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters