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

Single Sign On isn't working properly #1577

Open
msiukdev opened this issue Jun 7, 2023 · 1 comment
Open

Single Sign On isn't working properly #1577

msiukdev opened this issue Jun 7, 2023 · 1 comment

Comments

@msiukdev
Copy link

msiukdev commented Jun 7, 2023

I was creating a token with an external user, using the following link : https://help.form.io/developers/integrations/auth.
Here's my token generating function using c# code.

public IActionResult GenerateJwtToken()
{
var tokenHandler = new JwtSecurityTokenHandler();
var secretKey = Encoding.ASCII.GetBytes("--- change me now ---");
var jsonformu = new { _id = "647db743f08587cd2dd707cf" };
var jsonuser = new { _id = "external", data = new { name = "externaluser", email = "extuser@example.com" },
roles= new[] { "647db743f08587cd2dd707cf" }};
var tokenDescriptor = new SecurityTokenDescriptor
{
Subject = new ClaimsIdentity(new[]
{
new Claim("external", "true"),
new Claim("form", "{\r\n "_id":"647db743f08587cd2dd707cf"\r\n }"),
new Claim("user", "{\r\n "_id":"external",\r\n "data":{\r\n "name":"joe"\r\n },\r\n "roles":[\r\n "646341cc696df649c911183a"\r\n ]\r\n }")
}),
Expires = DateTime.UtcNow.AddMinutes(30),
SigningCredentials = new SigningCredentials(
new SymmetricSecurityKey(secretKey),
SecurityAlgorithms.HmacSha256Signature
)
};

        var token = tokenHandler.CreateToken(tokenDescriptor);
        var authorizedtoken = tokenHandler.WriteToken(token);
       
        return Ok();           
    }

When sending it to the formio server, on localhost it's giving Unauthorized error. Where do I look in the formio-master to find the problem? and where do I look in the formio-master if I want to configure OpenId Connect or OAuth for formio?

@brendanbond
Copy link
Contributor

@msiukdev any updates? Are you using our open source container or our Enterprise container? Truth be told, I'm not sure what kind of SSO support we provide in our open source container, although I suspect it could work. Give us a few more details and we'll try to get you sorted out.

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

No branches or pull requests

2 participants