Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PAYARA-2718 Added Microprofile Config support to OAuth definition ann… #2704

Merged
merged 7 commits into from
May 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/payara-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
fish.payara.notification.eventbus,
fish.payara.notification.healthcheck,
fish.payara.notification.requesttracing,
fish.payara.security.oauth2.annotation,
fish.payara.security.annotations,
fish.payara.security.oauth2.api
</Export-Package>
</instructions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
package fish.payara.security.oauth2.annotation;
package fish.payara.security.annotations;

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
Expand All @@ -55,49 +55,85 @@
*/
@Target({TYPE, METHOD})
@Retention(RUNTIME)
public @interface OAuth2AuthenticationDefinition {
public @interface OAuth2AuthenticationDefinition{

/**
* The Microprofile Config key for the auth endpoint is <code>{@value}</code>
*/
public static final String OAUTH2_MP_AUTH_ENDPOINT="payara.security.oauth2.authEndpoint";

/**
* Required. The URL for the OAuth2 provider to provide authentication
* <p>
* This must be a https endpoint
* This must be a https endpoint.
* </p>
* To set this using Microprofile Config use {@code payara.security.oauth2.authEndpoint}.
* @return
*/
@NotNull
String authEndpoint();

/**
* The Microprofile Config key for the token Endpoint is <code>{@value}</code>
*/
public static final String OAUTH2_MP_TOKEN_ENDPOINT="payara.security.oauth2.tokenEndpoint";

/**
* Required. The URL for the OAuth2 provider to give the authorisation token
* <p>
* To set this using Microprofile Config use {@code payara.security.oauth2.tokenEndpoint}
* @return
*/
@NotNull
String tokenEndpoint();

/**
* The Microprofile Config key for the clientId is <code>{@value}</code>
*/
public static final String OAUTH2_MP_CLIENT_ID="payara.security.oauth2.clientId";

/**
* Required. The client identifier issued when the application was registered
* <p>
* To set this using Microprofile Config use {@code payara.security.oauth2.cliendId}
* @return the client identifier
*/
@NotNull
String clientId();

/**
* The Microprofile Config key for the client secret is <code>{@value}</code>
*/
public static final String OAUTH2_MP_CLIENT_SECRET="payara.security.oauth2.clientSecret";

/**
* Required. The client secret
* <p>
* It is recommended to set this using an alias.
* </p>
* To set this using Microprofile Config use {@code payara.security.oauth2.clientSecret}
* @return
* @see <a href="https://docs.payara.fish/documentation/payara-server/password-aliases/password-aliases-overview.html">Payara Password Aliases Documentation</a>
*/
@NotNull
String clientSecret();

/**
* The Microprofile Config key for the redirect URI is <code>{@value}</code>
*/
public static final String OAUTH2_MP_REDIRECT_URI = "payara.security.oauth2.redirectURI";

/**
* The callback URI.
* <p>
* If supplied this must be equal to one set in the OAuth2 Authentication provider
* If supplied this must be equal to one set in the OAuth2 Authentication provider.
* <p>
* To set this using Microprofile Config use {@code payara.security.oauth2.redirectURI}
* @return
*/
String redirectURI() default "";

/**
* The Microprofile Config key for the scope is <code>{@value}</code>
*/
public static final String OAUTH2_MP_SCOPE = "payara.security.oauth2.scope";

/**
* The scope that will be requested from the OAuth provider
* @return
Expand Down
12 changes: 12 additions & 0 deletions appserver/payara-appserver-modules/security-oauth2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,18 @@
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile.config</groupId>
<artifactId>microprofile-config-api</artifactId>
<version>${microprofile-config.version}</version>
<type>jar</type>
</dependency>
<dependency>
Copy link
Contributor

@MarkWareham MarkWareham May 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add <scope>provided</scope> here to prevent problems

<groupId>fish.payara.nucleus.microprofile.config</groupId>
<artifactId>microprofile-config-service</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>
</dependencies>

<build>
Expand Down
Loading