forked from apache/cloudstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into database-views-management-via-separated-files
- Loading branch information
Showing
59 changed files
with
3,434 additions
and
56 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,5 +95,4 @@ public void execute() { | |
response.setObjectName("keypair"); | ||
setResponseObject(response); | ||
} | ||
|
||
} | ||
} |
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 |
---|---|---|
|
@@ -76,5 +76,4 @@ public void execute() { | |
response.setResponseName(getCommandName()); | ||
setResponseObject(response); | ||
} | ||
|
||
} | ||
} |
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
53 changes: 53 additions & 0 deletions
53
api/src/main/java/org/apache/cloudstack/auth/UserOAuth2Authenticator.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,53 @@ | ||
// 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.cloudstack.auth; | ||
|
||
import com.cloud.utils.component.Adapter; | ||
import com.cloud.utils.exception.CloudRuntimeException; | ||
|
||
public interface UserOAuth2Authenticator extends Adapter { | ||
/** | ||
* Returns the unique name of the provider | ||
* @return returns provider name | ||
*/ | ||
String getName(); | ||
|
||
/** | ||
* Returns description about the OAuth2 provider plugin | ||
* @return returns description | ||
*/ | ||
String getDescription(); | ||
|
||
/** | ||
* Verifies if the logged in user is | ||
* @return returns true if its valid user | ||
*/ | ||
boolean verifyUser(String email, String secretCode); | ||
|
||
/** | ||
* Verifies the code provided by provider and fetches email | ||
* @return returns email | ||
*/ | ||
String verifyCodeAndFetchEmail(String secretCode); | ||
|
||
|
||
/** | ||
* Fetches email using the accessToken | ||
* @return returns email | ||
*/ | ||
String getUserEmailAddress() throws CloudRuntimeException; | ||
} |
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
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
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,63 @@ | ||
<!-- | ||
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. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>cloud-plugin-user-authenticator-oauth2</artifactId> | ||
<name>Apache CloudStack Plugin - User Authenticator OAuth2</name> | ||
<parent> | ||
<groupId>org.apache.cloudstack</groupId> | ||
<artifactId>cloudstack-plugins</artifactId> | ||
<version>4.19.0.0-SNAPSHOT</version> | ||
<relativePath>../../pom.xml</relativePath> | ||
</parent> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.cloudstack</groupId> | ||
<artifactId>cloud-utils</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.cloudstack</groupId> | ||
<artifactId>cloud-framework-config</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.apis</groupId> | ||
<artifactId>google-api-services-docs</artifactId> | ||
<version>v1-rev20220609-1.32.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.apis</groupId> | ||
<artifactId>google-api-services-oauth2</artifactId> | ||
<version>v2-rev20200213-1.32.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.oauth-client</groupId> | ||
<artifactId>google-oauth-client-servlet</artifactId> | ||
<version>1.34.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.http-client</groupId> | ||
<artifactId>google-http-client-jackson2</artifactId> | ||
<version>1.20.0</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
61 changes: 61 additions & 0 deletions
61
...r-authenticators/oauth2/src/main/java/org/apache/cloudstack/oauth2/OAuth2AuthManager.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,61 @@ | ||
// | ||
// 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.cloudstack.oauth2; | ||
|
||
import com.cloud.utils.component.PluggableService; | ||
import org.apache.cloudstack.api.auth.PluggableAPIAuthenticator; | ||
import org.apache.cloudstack.auth.UserOAuth2Authenticator; | ||
import org.apache.cloudstack.framework.config.ConfigKey; | ||
import org.apache.cloudstack.oauth2.api.command.RegisterOAuthProviderCmd; | ||
import org.apache.cloudstack.oauth2.api.command.UpdateOAuthProviderCmd; | ||
import org.apache.cloudstack.oauth2.vo.OauthProviderVO; | ||
|
||
import java.util.List; | ||
|
||
public interface OAuth2AuthManager extends PluggableAPIAuthenticator, PluggableService { | ||
public static ConfigKey<Boolean> OAuth2IsPluginEnabled = new ConfigKey<Boolean>("Advanced", Boolean.class, "oauth2.enabled", "false", | ||
"Indicates whether OAuth plugin is enabled or not", false); | ||
public static final ConfigKey<String> OAuth2Plugins = new ConfigKey<String>("Advanced", String.class, "oauth2.plugins", "google,github", | ||
"List of OAuth plugins", true); | ||
public static final ConfigKey<String> OAuth2PluginsExclude = new ConfigKey<String>("Advanced", String.class, "oauth2.plugins.exclude", "", | ||
"List of OAuth plugins which are excluded", true); | ||
|
||
/** | ||
* Lists user OAuth2 provider plugins | ||
* @return list of providers | ||
*/ | ||
List<UserOAuth2Authenticator> listUserOAuth2AuthenticationProviders(); | ||
|
||
/** | ||
* Finds user OAuth2 provider by name | ||
* @param providerName name of the provider | ||
* @return OAuth2 provider | ||
*/ | ||
UserOAuth2Authenticator getUserOAuth2AuthenticationProvider(final String providerName); | ||
|
||
String verifyCodeAndFetchEmail(String code, String provider); | ||
|
||
OauthProviderVO registerOauthProvider(RegisterOAuthProviderCmd cmd); | ||
|
||
List<OauthProviderVO> listOauthProviders(String provider, String uuid); | ||
|
||
boolean deleteOauthProvider(Long id); | ||
|
||
OauthProviderVO updateOauthProvider(UpdateOAuthProviderCmd cmd); | ||
} |
Oops, something went wrong.