It is now time for the conclusion of this trilogy.
Previously in "CPPM / Meridian integration":
- 我们看到了Meridian can easily integrate with ClearPass(使用oauth2)并喜欢它
- Then we discovered thatClearPass can share custom attributes with Meridian为了显示自定义内容(至少在“用户详细信息子午应用程序”页面中)。
And that's exactly where I want to drive you: use ClearPass custom user attributes to display a specific page depending on who is connecting to the Meridian App. Here's how to do it.
First of all, we need to know which kind of info we want to show, thus which custom attributes to use. In my setup, I'd like to:
- 首先,在我在ClearPass中创建新来宾用户时创建议程
- Associate this agenda to my new guest
- Display this agenda in the Meridian App when the guest is registered
Here is what we need:
- Web服务器(我的设置议程)将托管“访客/议程创建”页面以及Meridian应用程序中的议程显示
- A database (in my case MariaDB) to store agenda details and map agenda to guests
- 当然 子午线和ClearPass
For the database, I'll use the following structure:

<-- Please note:
如您所见,我还有一张名为员工的表。这是因为,在我的设置中,我还想将一些公司用户(例如销售客户经理)的访客/议程列表关联,以便这些公司用户也可以访问与负责客人相同的议程。有趣的是,对于这些员工而言,我不需要在ClearPass中创建客人:我直接使用了广告认证。有趣的是,基于他们的电子邮件地址,我添加了一个Yammer API调用以获取其图片URL并将其显示在子午线应用程序网页上J
>
Now we have the structure let's first manage the guest / agenda creation.
Guest / agenda creation
For this, we'll use an Apache server and we'll code using HTML, Python and JavaScript. We'll also use Bootstrap library so that the page/fields / images etc resize automatically depending on the size of the Window / Device.
Don't worry, I won't copy/paste the entire code here, only main lines. But the entire project is accessible in GitHub这里.
Let's describe the flow:
- First, we need to authenticate the users via ClearPass API (so that only local ClearPass users and Corporate AD users can manage accounts).
以下是Python身份验证脚本的主要部分(从HTML / JS文件调用):authuri =“/api/oauth” headers = {'content-type':'application/json'} d = {'grant_type':'password':'password','username':str(username),'password),'password':str(password(密码)),'client_id':clientId} url = cppmbaseurl + authuri#请求对来宾管理器进行身份验证并接收相应的令牌(强制创建访客)data = requests.post(url,headers = headers = headers,data = json.dumps(json.dumps(d))).json()if数据中的“ access_token”:返回数据['access_token']返回无因此,最后,我们得到一个令牌,我们稍后可以使用CPPM来宾。
- Then we create the agenda and agenda entries in the DB, based on the data we get from the HTML Form.
Again, here are the most interesting parts:mysqlquery ='插入议程(标题,位置,日期,徽标)值(“%s”,“%s”,str_to_date(“%s”,“%s”),“%s”),“%s”)'%(标题,title,位置,日期,dateformat,徽标)mysqlquery ='插入议程(议程,启动时间,内容,演示者,day)值(“%s”,“%s”,“%s”,“%s”,“%s”,“%s”,“%s”,“%s””)'%(议程,data ['begin'],data ['content'],data ['pres'],data ['day'])
- 之后,我们在ClearPass和DB中创建来宾用户(再次使用HTML表单数据);我们将客人和议程归功于议程ID领域。
Guest creation in ClearPass:
标题= {'授权':'bearer' +令牌,'content-type':'application/json'} baseuri =“/api/guest/guest”#guest for Guest for Guest for Guest Creation apiresult = request = requests.post(url,headers = headers = headers = headers = headers = headers = headers = headers,data = json.dumps(data))。json()在DB中:
mysqlquery ='插入访客(姓名,电子邮件,议程,pictureurl,company)值(“%s”,“%s”,“%d”,“%s”,“%s”,“%s”),上面重复键更新名称=“%s”,regendasrc =“%d”,ctifulUrl =“%s”,company =“%s”'%(data ['visitor_name'],data ['email'],data ['visitor_picture'],data ['visitor_company'],data ['visitor_name'],议程,data ['visitor_picture'],data ['visitor_company'])
- Finally, we create employee users in the DB, get picture URL via Yammer API and put this all together in the DB.
Employee creation, with agenda info, in the DB:
MySQLQuery = 'INSERT INTO Employee (Email,AgendaID) VALUES ("%s","//www.nexbus-cng.com/blogs/industries/combine-meridian-clearpass-to-improve-user-experience-3-3/%d") ON DUPLICATE KEY UPDATE Agendasrc="//www.nexbus-cng.com/blogs/industries/combine-meridian-clearpass-to-improve-user-experience-3-3/%d"' % (employee,agendaID,agendaID)Get employee picture URL in Yammer info (update in DB code is similar as previous examples):
YammerBaseURL="https://www.yammer.com" auth_token="
" headers={'Authorization':'Bearer ' + auth_token} GetUserByEmailURI="/api/v1/users/by_email.json?email=" result = "" url = YammerBaseURL + GetUserByEmailURI + email userInfojson = requests.get(url,headers=headers).json() userPictureTemp = userInfojson[0]['mugshot_url_template']
And here is the result (I know, I'm not a Web designer, so I tried to keep it as simple as possible ):
Authentication

Guests / Agenda form

Email Receipt

DB中的议程和议程条目


Employee entries in DB

DB中的客人参赛作品

And in ClearPass

子午线设置
在子午线方面,我们要做的就是添加一个新的网页,该页面将指向我们的Web服务器上显示的议程页面。
IMPORTANT: This page must be a "Hosted" Web Page, otherwise the token won't be sent in the header when accessing it from the app.
We also checked the "Requires Login" option in order to be sure the user is authenticated and so have a token.

Agenda Display Web Page
Now we need to create the web page we want to display when a Meridian user opens the agenda in the App.
总而言之,在此页面中,我们:
- 从子午线应用程序中将令牌发送到页面的标题中
- 基于此令牌,我们通过ClearPass API获取用户其他参数(有关这些附加参数的更多信息,请参见the second episode of this blog trilogy
- Build the web page based on these additional parameters and DataBase entries
Again if you want to see the entire code, please have a look on Github这里.
这是主要步骤:
- Get the token:
import os token =re.sub('Bearer ','',os.environ['HTTP_AUTHORIZATION']) - 获取ClearPass其他参数:
meURI = "/api/oauth/me" headers={'Authorization':'Bearer ' + token ,'Content-Type':'application/json'} url = CPPMBaseURL + meURI # API URI call to get ClearPass user specific attribute based on the token parameter data = requests.post(url,headers=headers).json() - Build the web page based on ClearPass additional parameters and DataBase entries:
# Print the name of the user based on parameter got from CPPM print("""“”%(标题,日期,数据['image'],data ['badge']))…(github上的完整代码)
%s的议程
“”%(data ['name']))dateFormat ='%m/%d/%y'#sql查询以检索议程主信息(基于用户CPPM参数:议程)gartendasqlquery ='选择标题,位置,位置,徽标,date_format(date,'%s')来自议程中的id =%s'%(dateformat,data ['endenda'])sqlresult = get_db_query(argendasqlquery)size size ='100'#在html页面中显示此信息sqlresult中的标题,位置,徽标,日期):如果数据['image']:print(“”“”%s, Date: %s
结论
Finally, at the end of this series, the flow can be summarised as the following graph:

And the result, from a user experience point of view, is:

So we finally make it: we have a complete Meridian – ClearPass integration! Just to remind you, here is what we have:
- Authentication in Meridian App through ClearPass (博客1)
- ClearPass中的其他自定义参数我们可以在子午线应用中使用(Blog 2)
- Meridian应用中的自定义网页,该页面使用这些附加参数传递自定义内容(此博客)
希望您喜欢这次旅行,并随时发表评论(带有言论或问题)。现在,您可以安全地释放安全带,我们已经到达目的地。