Git Product home page Git Product logo

Comments (9)

russellhaering avatar russellhaering commented on August 18, 2024

I like the url.Form pattern and I'm open to breaking compatibility.

@andrewstuart since I get the sense you're using this, any thoughts?

from gosaml2.

andrewstuart avatar andrewstuart commented on August 18, 2024

Yeah, that's a pattern used all over the place in Go (also in url.Values, http.Header, e.g.), so it makes sense to me, and wouldn't cause me any issues. I might try to throw together a quick PR for that as well tonight, to have a custom type like the net/* packages are fond of doing.

from gosaml2.

fatlotus avatar fatlotus commented on August 18, 2024

If so, can I request a way of getting (or looking up by) the FriendlyName field as well? I'm seeing behavior somewhat like the following (this is for an Internet2 Shib IdP):

<saml2:Attribute
    FriendlyName="eduPersonEntitlement"
    Name="urn:oid:1.3.6.1.4.1.5923.1.1.1.7"
    NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
  <saml2:AttributeValue
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:type="xsd:string">
    urn:mace:dir:entitlement:common-lib-terms
  </saml2:AttributeValue>
  <saml2:AttributeValue
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:type="xsd:string">
    https://university.edu/path/to/thingy
  </saml2:AttributeValue>
  <saml2:AttributeValue
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:type="xsd:string">
    urn:mace:incommon:entitlement:common:1
  </saml2:AttributeValue>
</saml2:Attribute>

from gosaml2.

andrewstuart avatar andrewstuart commented on August 18, 2024

@fatlotus I'm all for that too, as the URNs are pretty hard to work with. I will note, however that the spec (line 1201) explicitly mentions that "This attribute's value MUST NOT be used as a basis for formally identifying SAML attributes."

So we may want to consider what such an API might look like, such UnsafeGetFriendlyName(fname) or some such method name. Or maybe a strong note in the docs would be enough. Thoughts?

from gosaml2.

fatlotus avatar fatlotus commented on August 18, 2024

Oof. Perhaps a bit obtuse, but maybe override .String() to return the raw XML? That way a human can .Printf(...) the result for hints, but would be strongly discouraged from hard-coding a FriendlyName into their code.

Or, alternately: an unexported property that shows up in "%#v" but is otherwise inaccessible.

from gosaml2.

andrewstuart avatar andrewstuart commented on August 18, 2024

So I've got something pulled together here, but this method (since it uses type aliasing rather than a struct) would be unable to store any additional metadata like FriendlyName.

Another alternative, perhaps more flexible, is to just create an Attribute struct, and use map[string][]Attribute for AssertionInfo.Values:

type Attribute struct {
  Values []string
  Name string
  FriendlyName string
}

This has the benefit of being multi-valued, including FriendlyName, yet still being indexed by Name, hopefully somewhat discouraging reliance upon FriendlyName as the key.

from gosaml2.

russellhaering avatar russellhaering commented on August 18, 2024

I like that. I'd combine it with the type alias like you've already got for easy access by Name.

from gosaml2.

andrewstuart avatar andrewstuart commented on August 18, 2024

Okay, I put something together, and I really think we arrived at a nice, clean API. Let me know what you think. :-)

from gosaml2.

fatlotus avatar fatlotus commented on August 18, 2024

Closed by #10.

from gosaml2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.