Skip to content

Error parsing Oauth properties in cncf spec using java sdk #357

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

Closed
ricardozanini opened this issue May 23, 2024 · 2 comments · Fixed by #363
Closed

Error parsing Oauth properties in cncf spec using java sdk #357

ricardozanini opened this issue May 23, 2024 · 2 comments · Fixed by #363
Assignees
Labels

Comments

@ricardozanini
Copy link
Member

ricardozanini commented May 23, 2024

Discussed in serverlessworkflow/specification#857

Originally posted by mahith2108 May 23, 2024
Hi,
we are using Java sdk version "4.0.5.Final" and spec version: 0.8 as suggested (https://github.com/serverlessworkflow/sdk-java)

I am trying to define Oauth properties using "auth" field in my spec as follows based on serverlessworkflow/specification#675

 "auth":[
            { "name" : "serviceCloud",
            "scheme": "oauth2",
            "properties":{
               "scopes": ["$$$$XXXMMMMM"],
               "audiences":["%%%XXXXXXX"] 
            }
            
        }]

while parsing the spec using Workflow.fromSource("") I am getting following error.

Could not convert markup to Workflow: Unrecognized field "scopes" (class io.serverlessworkflow.api.auth.BasicAuthDefinition), not marked as ignorable (3 known properties: "password", "username", "metadata"])
 at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: io.serverlessworkflow.api.Workflow["auth"]->io.serverlessworkflow.api.auth.BasicAuthDefinition["scopes"])

we have tried following spec as well but the authDefinition.getOauth() is coming as null.

 "auth":[
            { "name" : "serviceCloud",
            "scheme": "oauth2",
            "oauth":{
               "scopes": ["%%%%%X"],
               "audiences":["%%%XXXXXX"] 
            }
        }]
@JsonPropertyOrder({"name", "scheme", "basicauth", "bearerauth", "oauth"})
public class AuthDefinition implements Serializable {
@ricardozanini ricardozanini transferred this issue from serverlessworkflow/specification May 23, 2024
@ricardozanini ricardozanini self-assigned this May 27, 2024
@ricardozanini
Copy link
Member Author

@mahith2108, FYI grantType and clientId are required for OAuth: https://github.com/serverlessworkflow/specification/blob/0.8.x/schema/auth.json#L191

I'll fix this validation and make sure the object conforms with the spec, thou.

ricardozanini added a commit to ricardozanini/sdk-java that referenced this issue May 28, 2024
@mahith2108
Copy link

thanks

ricardozanini added a commit that referenced this issue May 29, 2024
@github-project-automation github-project-automation bot moved this from Backlog to Done in Progress Tracker May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants