Hi,

As part of a project, I've made some improvements to the OpenId
attribute exchange. Together with
https://www.assembla.com/spaces/liftweb/tickets/329-Make-OpenID-support-more-extensible

this makes it possible to easily get attributes from different
providers. Ie you can write stuff like this:

def ext(di:DiscoveryInformation, authReq: AuthRequest): Unit = {
    import WellKnownAttributes._
    WellKnownEndpoints.findEndpoint(di) map {ep => 
      ep.makeAttrExtension(List(Email, FullName, FirstName, LastName)) foreach 
{ex => authReq.addExtension(ex)}}
}
  

SimpleOpenIdVendor.OpenIdObject.is.beforeAuth = Full(ext _)

object MyVendor extends SimpleOpenIdVendor  {
  override def postLogin(id: Box[Identifier],res: VerificationResult): Unit = {
    id match {
      case Full(id) => 
          val attrs = WellKnownAttributes.attributeValues(res.getAuthResponse)
          
          import WellKnownAttributes._
          val name = attrs.get(FullName) orElse attrs.get(FirstName) getOrElse 
"Unknown"
          val email = attrs.get(Email) getOrElse ""
          
          S.notice("Welcome "+name + " " + email)
      case _ => S.error("Failed to authenticate")
    }

    OpenIdUser(id)
  }
}

Is there interest in getting this into lift-openid?

/Jeppe

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.

Reply via email to