-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: introduce
AuthUser
interface
Replace the references to `OAuth2User` by `AuthUser`. This allows downstream extenders to more easily contribute alternative OAuth2 providers: If the expected data is stored in different attributes it will be possible to bridge it by implementing the proper `AuthUser`.
- Loading branch information
1 parent
0ce7b7b
commit 736cbf4
Showing
3 changed files
with
119 additions
and
34 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
48 changes: 48 additions & 0 deletions
48
server/src/main/java/org/eclipse/openvsx/security/AuthUser.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,48 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2023 Ericsson and others | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
********************************************************************************/ | ||
package org.eclipse.openvsx.security; | ||
|
||
/** | ||
* Encapsulate information about freshly authenticated users. | ||
* | ||
* Different OAuth2 providers may return the same information with different | ||
* attribute keys. This interface allows bridging arbitrary providers. | ||
*/ | ||
public interface AuthUser { | ||
/** | ||
* @return Non-human readable unique identifier. | ||
*/ | ||
String getAuthId(); | ||
/** | ||
* @return The user's avatar URL. Some services require post-processing to get the actual value for it | ||
* (the value returned is a template and you need to remplace variables). | ||
*/ | ||
String getAvatarUrl(); | ||
/** | ||
* @return The user's email. | ||
*/ | ||
String getEmail(); | ||
/** | ||
* @return The user's full name (first and last names). | ||
*/ | ||
String getFullName(); | ||
/** | ||
* @return The login name for the user. Human-readable unique name. AKA username. | ||
*/ | ||
String getLoginName(); | ||
/** | ||
* @return The authentication provider unique name, e.g. `github`, `eclipse`, etc. | ||
*/ | ||
String getProviderId(); | ||
/** | ||
* @return The authentication provider URL. | ||
*/ | ||
String getProviderUrl(); | ||
} |
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