|
13 | 13 | * See the License for the specific language governing permissions and |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | | -package io.serverlessworkflow.impl.executors.http; |
| 16 | +package io.serverlessworkflow.impl.auth; |
17 | 17 |
|
18 | 18 | import io.serverlessworkflow.api.types.AuthenticationPolicyUnion; |
| 19 | +import io.serverlessworkflow.api.types.EndpointConfiguration; |
19 | 20 | import io.serverlessworkflow.api.types.ReferenceableAuthenticationPolicy; |
20 | 21 | import io.serverlessworkflow.api.types.Workflow; |
21 | 22 | import io.serverlessworkflow.impl.WorkflowApplication; |
22 | 23 | import io.serverlessworkflow.impl.WorkflowDefinition; |
23 | 24 | import java.util.Optional; |
24 | 25 |
|
25 | | -class AuthProviderFactory { |
| 26 | +public class AuthProviderFactory { |
26 | 27 |
|
27 | 28 | private AuthProviderFactory() {} |
28 | 29 |
|
29 | | - static final String AUTH_HEADER_NAME = "Authorization"; |
| 30 | + public static Optional<AuthProvider> getAuth( |
| 31 | + WorkflowDefinition definition, EndpointConfiguration configuration) { |
| 32 | + return configuration == null |
| 33 | + ? Optional.empty() |
| 34 | + : getAuth(definition, configuration.getAuthentication()); |
| 35 | + } |
30 | 36 |
|
31 | 37 | public static Optional<AuthProvider> getAuth( |
32 | 38 | WorkflowDefinition definition, ReferenceableAuthenticationPolicy auth) { |
@@ -64,9 +70,8 @@ private static Optional<AuthProvider> buildFromPolicy( |
64 | 70 | new BearerAuthProvider( |
65 | 71 | app, workflow, authenticationPolicy.getBearerAuthenticationPolicy())); |
66 | 72 | } else if (authenticationPolicy.getDigestAuthenticationPolicy() != null) { |
67 | | - return Optional.of( |
68 | | - new DigestAuthProvider( |
69 | | - app, workflow, authenticationPolicy.getDigestAuthenticationPolicy())); |
| 73 | + // TODO implement digest authentication |
| 74 | + return Optional.empty(); |
70 | 75 | } else if (authenticationPolicy.getOAuth2AuthenticationPolicy() != null) { |
71 | 76 | return Optional.of( |
72 | 77 | new OAuth2AuthProvider( |
|
0 commit comments