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

Implement Declarative Auth Design for ballerina/http Module #155

Merged
merged 28 commits into from
Jan 19, 2021

Conversation

ldclakmal
Copy link
Member

@ldclakmal ldclakmal commented Jan 13, 2021

Purpose

This PR introduces the declarative auth design for HTTP listener.

Design: https://docs.google.com/document/d/1dGw5uUP6kqZNTwMfQ_Ik-k0HTMKhX70XpEA3tys9_kk/edit?usp=sharing

Example:

import ballerina/http;
 
@http:ServiceConfig {
   auth: [
      {
         jwtValidatorConfig: {
            issuer: "ballerina",
            audience: ["wso2"],
            jwksConfig: {
               url: "https://localhost:8080/jwks"
            }
         },
         scopes: ["update", "write"]
      },
      {
         introspectionConfig: {
            url: "https://localhost:9090/oauth2/introspect",
            tokenTypeHint: "access-token",
            clientConfig: {
               auth: { username: "tom", password: "123" },
               secureSocket: {
                  trustStore: {
                     path: "/path/to/truststore.p12",
                     password: "ballerina"
                  }
               }
            }
         },
         scopes: ["update", "write"]
      }
   ]
}
service http:Service /hello on new(9090) {
   resource function post /foo(json payload) returns string {
       // business logic
   }
}

Fixes ballerina-platform/ballerina-library#813
Fixes ballerina-platform/ballerina-library#74

Related to ballerina-platform/ballerina-library#584

@ldclakmal ldclakmal marked this pull request as ready for review January 15, 2021 13:00
@ldclakmal ldclakmal marked this pull request as draft January 16, 2021 05:57
@ldclakmal ldclakmal marked this pull request as ready for review January 19, 2021 06:50
@ldclakmal ldclakmal merged commit 7584086 into ballerina-platform:master Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement declarative auth design for ballerina/http module Align stdlib annotations with spec
2 participants