How to get 'ndefMessage' object value using 'nfc.readerMode()' function in ionic/typescript - cordova-plugins

I created a function under which I am calling this code : -
this.nfc.readerMode(this.flags).subscribe((tag) => {
this.sucessMessage = tag;
his.scanSuccessfully('Scanned successfully.');
}, (error) => this.errorMessageNFC(error));
When NFC tag is scanned I only got this response : -
{
id : [4, 96, 117, 74, -17, 34, -128],
techTypes : ["android.nfc.tech.IsoDep", "android.nfc.tech.NfcA", "android.nfc.tech.Ndef"]
},
Where as it need to give me response like
{
"isWritable": true,
"id": [4, 96, 117, 74, -17, 34, -128],
"techTypes": ["android.nfc.tech.IsoDep", "android.nfc.tech.NfcA", "android.nfc.tech.Ndef"],
"type": "NFC Forum Type 4",
"canMakeReadOnly": false,
"maxSize": 2046,
"ndefMessage": [{
"id": [],
"type": [116, 101, 120, 116, 47, 112, 103],
"payload": [72, 101, 108, 108, 111, 32, 80, 104, 111, 110, 101, 71, 97, 112],
"tnf": 2
}]
}
I am using 'phonegap-nfc-npm' plugin.

Related

Minimize nested loops

I have the following code with nested loops. How can I minimize the loop?
users result is like:
users = [[35, 61, 62, 63, 64, 65, 66, 67, 68, 69, nil, 70, 71, 72, 73,
74, 75, 78, 79, 92, 94, 95, 154, 164, 292, 293, 294, 295, 314],
[],
[35],
[],
[35, 79, 88],
[],
[],
[36, 35, 56, 78, 87, 95, 65],
[63, 72, 78, 80, 81, 82, 84, 87, 90, 93, nil, 96, 111, 157, 159, 160, 271,
272, 66, 295, 296, 297, 298, 299, 300, 301, 305, 307, 308, 71, 315],
[],
[79, 83, 85, 86, 89, 91, 161, 162, 163, 67, 294, 302, 303, 304, 306,
309, 310, 311, 312, 313],
[],
[314],
[314],
[]
]
That's why I need to loop the object in each elements.
And array value is:
array = [309, 310, 305, 304, 90, 162, 78, 297, 296, 272, 271, 84, 91, 308,
299, 79, 87, 298, 301, 163, 81, 72, 83, 111, 86, 313, 164, 300, 159,
315, 160, 307, 82, 69, 312, 89
]
Thanks!
0.upto(users.count).each do |i|
users[i].each do |user_id|
if array.include?(user_id)
puts user_id
end
end
end
From my understanding, you want to get the common elements from users and array.
At first make the users array flatten to make it a single array. Then make it a uniq so that one id doesn't repeat again. compact will remove the nil values. After that make a & operation with array. And you got your result.
result = users.flatten.uniq.compact & array
Now if you want to print the result
puts result
If each sub array of users has no repeated elements, then the following should work
users.each { |user| puts array & user }

Rails uniq Public Activity

t = PublicActivity::Activity.arel_table
#activities = PublicActivity::Activity.where(
(t[:trackable_type].eq("Lesson").and(t[:trackable_id].in(#my_lessons_ids)))
.or(t[:trackable_type].eq("Post").and(t[:trackable_id].in(#my_posts_ids)))
.or(t[:trackable_type].eq("WallPost").and(t[:trackable_id].in(#my_wallposts_ids)))
.or(t[:trackable_type].eq("Comment").and(t[:trackable_id].in(#my_comments_ids)))
.or(t[:trackable_type].eq("Course").and(t[:trackable_id].in(#my_courses_ids)))
.or(t[:trackable_type].eq("Group").and(t[:trackable_id].in(#my_groups_ids)))
).order("id DESC").uniq{|a| "#{a.trackable_type}-#{a.trackable_id}"}
In my database I have duplicate entries for "Trackable_type"+"trackable_id" because if a user click on "update" many times I get many entries.
So, I want only to get one of these.
I tried with
.uniq{|a| "#{a.trackable_type}-#{a.trackable_id}"}
but nothing happens.
Returned SQL QUERY:
"SELECT DISTINCT \"activities\".* FROM \"activities\" WHERE
(((((\"activities\".\"trackable_type\" = 'Lesson' AND
\"activities\".\"trackable_id\" IN (11, 39, 40, 16, 5, 3, 12, 9, 13,
19, 18, 37, 15, 23, 24, 29, 20, 10, 25, 26, 27, 17, 28, 22, 21, 30,
33, 35, 34, 36, 32, 31) OR \"activities\".\"trackable_type\" = 'Post'
AND \"activities\".\"trackable_id\" IN (50, 49, 48, 47, 46, 45, 44,
43, 42, 41, 40, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25,
24, 23, 22, 21, 20, 19, 18, 17, 14, 13, 12, 10, 5)) OR
\"activities\".\"trackable_type\" = 'WallPost' AND
\"activities\".\"trackable_id\" IN (158, 157, 155, 154, 153, 152, 151,
132, 131, 130, 129, 128, 127, 126, 125, 124, 119, 118, 117, 116, 115,
114, 113, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100,
99, 98, 93, 92, 91, 90, 87, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76,
75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59,
58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42,
41, 39, 38, 37, 36, 35, 34, 33, 31, 30, 29, 28, 27, 26, 25, 24, 22,
20, 19, 17, 16, 15, 14, 13, 10, 7, 6, 5, 4)) OR
\"activities\".\"trackable_type\" = 'Comment' AND
\"activities\".\"trackable_id\" IN (100, 99, 98, 95, 83, 82, 81, 79,
78, 71, 70, 69, 68, 67, 65, 63, 62, 61, 60, 59, 58, 57, 56, 55, 52,
51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35,
34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18,
17, 16, 15, 14)) OR \"activities\".\"trackable_type\" = 'Course' AND
\"activities\".\"trackable_id\" IN (8, 1, 5, 7)) OR
\"activities\".\"trackable_type\" = 'Group' AND
\"activities\".\"trackable_id\" IN (14, 11, 4, 5, 6, 3, 2, 1)) ORDER
BY id DESC"
UPDATE:
if I try:
#activities = PublicActivity::Activity.select("distinct trackable_type, trackable_id").where(
(t[:trackable_type].eq("Lesson").and(t[:trackable_id].in(#my_lessons_ids)))
.or(t[:trackable_type].eq("Post").and(t[:trackable_id].in(#my_posts_ids)))
.or(t[:trackable_type].eq("WallPost").and(t[:trackable_id].in(#my_wallposts_ids)))
.or(t[:trackable_type].eq("Comment").and(t[:trackable_id].in(#my_comments_ids)))
.or(t[:trackable_type].eq("Course").and(t[:trackable_id].in(#my_courses_ids)))
.or(t[:trackable_type].eq("Group").and(t[:trackable_id].in(#my_groups_ids)))
).order("id DESC")
I get this:
UPDATE 2
If I try
#activities = PublicActivity::Activity.select("DISTINCT ON(trackable_type, trackable_id) *")
I get
PG::SyntaxError: ERROR: syntax error at or near "ON" LINE 1: SELECT COUNT(DISTINCT ON(trackable_type, trackable_id) *) FR... ^ : SELECT COUNT(DISTINCT ON(trackable_type, trackable_id) *) FROM "activities"
Your query without arel will be :
PublicActivity::Activity.select("DISTINCT ON(trackable_type, trackable_id) *")
.where("(trackable_type = ? and trackable_id IN (?))
or (trackable_type = ? and trackable_id IN (?))",
"Lesson", #my_lessons_ids,
"Post", #my_post_ids)

GetAccessToken gives Bad Data exception

I need to create an OAuth2 Authorization Server and using DotNetOpenAuth.
I’m able to receive an Access_Token, but when I want to access a resource from my ResouceServer I get a cryptic error “Bad Data”. I can’t figure out what is bad about the data. (and how to fix it)
It seems that I get a correct token. When I ‘corrupt’ the token, I receive another message.
I call the Resource Server with the following code (this works when I connect to the Google OAuth2 service)
using (WebClient client = new WebClient())
{
client.Headers.Add( HttpRequestHeader.Authorization, "Bearer " + tbToken.Text);
ltext.Text = client.DownloadString(string.Format(#"http://localhost:50299/oauth/userinfo.aspx"));
}
(I know, the token should not be in the Textbox...but first let’s make it work ;-)
Then I access the Resource in userinfo.aspx
protected void Page_Init(object sender, EventArgs e)
{
HttpRequestBase request = new HttpRequestWrapper(Request);
using (var signing = CreateAuthorizationServerSigningServiceProvider())
{
using (var encrypting = CreateResourceServerEncryptionServiceProvider())
{
var resourceServer = new ResourceServer(new StandardAccessTokenAnalyzer(signing, encrypting));
string[] requiredScopes = { "email" };
try
{
var x = resourceServer.GetAccessToken(request, requiredScopes);
}
catch (Exception ee)
{
//HERE IS THE BAD DATA EXCEPTION
}
}
}
}
internal static RSACryptoServiceProvider CreateResourceServerEncryptionServiceProvider()
{
var resourceServerEncryptionServiceProvider = new RSACryptoServiceProvider();
resourceServerEncryptionServiceProvider.ImportParameters(ResourceServerEncryptionPrivateKey);
return resourceServerEncryptionServiceProvider;
}
internal static RSACryptoServiceProvider CreateAuthorizationServerSigningServiceProvider()
{
var authorizationServerSigningServiceProvider = new RSACryptoServiceProvider();
authorizationServerSigningServiceProvider.ImportParameters(AuthorizationServerSigningPublicKey);
return authorizationServerSigningServiceProvider;
}
//Yeah. I know...this is the example certificate from the demo code
public static readonly RSAParameters AuthorizationServerSigningPublicKey = new RSAParameters
{
Exponent = new byte[] { 1, 0, 1 },
Modulus = new byte[] { 210, 95, 53, 12, 203, 114, 150, 23, 23, 88, 4, 200, 47, 219, 73, 54, 146, 253, 126, 121, 105, 91, 118, 217, 182, 167, 140, 6, 67, 112, 97, 183, 66, 112, 245, 103, 136, 222, 205, 28, 196, 45, 6, 223, 192, 76, 56, 180, 90, 120, 144, 19, 31, 193, 37, 129, 186, 214, 36, 53, 204, 53, 108, 133, 112, 17, 133, 244, 3, 12, 230, 29, 243, 51, 79, 253, 10, 111, 185, 23, 74, 230, 99, 94, 78, 49, 209, 39, 95, 213, 248, 212, 22, 4, 222, 145, 77, 190, 136, 230, 134, 70, 228, 241, 194, 216, 163, 234, 52, 1, 64, 181, 139, 128, 90, 255, 214, 60, 168, 233, 254, 110, 31, 102, 58, 67, 201, 33 },
};
internal static readonly RSAParameters ResourceServerEncryptionPrivateKey = new RSAParameters
{
Exponent = new byte[] { 1, 0, 1 },
Modulus = new byte[] { 166, 175, 117, 169, 211, 251, 45, 215, 55, 53, 202, 65, 153, 155, 92, 219, 235, 243, 61, 170, 101, 250, 221, 214, 239, 175, 238, 175, 239, 20, 144, 72, 227, 221, 4, 219, 32, 225, 101, 96, 18, 33, 117, 176, 110, 123, 109, 23, 29, 85, 93, 50, 129, 163, 113, 57, 122, 212, 141, 145, 17, 31, 67, 165, 181, 91, 117, 23, 138, 251, 198, 132, 188, 213, 10, 157, 116, 229, 48, 168, 8, 127, 28, 156, 239, 124, 117, 36, 232, 100, 222, 23, 52, 186, 239, 5, 63, 207, 185, 16, 137, 73, 137, 147, 252, 71, 9, 239, 113, 27, 88, 255, 91, 56, 192, 142, 210, 21, 34, 81, 204, 239, 57, 60, 140, 249, 15, 101 },
P = new byte[] { 227, 25, 96, 71, 220, 99, 11, 55, 15, 241, 153, 20, 32, 213, 68, 127, 246, 162, 153, 204, 98, 26, 10, 99, 46, 189, 35, 18, 162, 180, 184, 134, 230, 198, 156, 87, 52, 174, 74, 155, 163, 204, 252, 51, 232, 189, 135, 172, 88, 24, 52, 174, 72, 157, 81, 90, 118, 59, 142, 154, 152, 201, 62, 177 },
Q = new byte[] { 187, 229, 223, 233, 118, 20, 5, 251, 85, 8, 196, 3, 220, 232, 38, 159, 15, 95, 174, 162, 36, 13, 138, 239, 16, 85, 220, 104, 4, 162, 174, 160, 234, 133, 156, 33, 117, 139, 22, 112, 108, 214, 97, 178, 100, 191, 13, 177, 164, 30, 124, 48, 33, 118, 21, 137, 38, 59, 191, 13, 183, 5, 16, 245 },
DP = new byte[] { 225, 112, 117, 117, 160, 191, 233, 136, 53, 153, 158, 94, 174, 225, 71, 104, 200, 75, 77, 229, 232, 148, 245, 46, 212, 93, 9, 142, 28, 90, 206, 187, 140, 40, 41, 87, 32, 130, 204, 169, 136, 135, 154, 237, 100, 227, 144, 229, 115, 102, 68, 21, 167, 28, 20, 128, 122, 210, 80, 148, 3, 139, 243, 97 },
DQ = new byte[] { 133, 252, 100, 207, 232, 184, 92, 143, 157, 82, 115, 220, 65, 81, 118, 0, 228, 136, 153, 81, 219, 157, 160, 157, 218, 171, 47, 81, 41, 69, 12, 123, 136, 224, 159, 182, 40, 72, 119, 70, 210, 5, 137, 131, 25, 94, 55, 152, 157, 236, 115, 40, 43, 36, 54, 53, 39, 131, 97, 56, 153, 114, 206, 101 },
InverseQ = new byte[] { 129, 119, 84, 118, 29, 35, 194, 186, 96, 169, 7, 7, 200, 22, 187, 34, 72, 131, 200, 246, 79, 120, 49, 242, 8, 220, 74, 114, 195, 95, 90, 108, 80, 2, 212, 71, 125, 100, 184, 77, 203, 236, 64, 122, 108, 212, 150, 129, 66, 248, 218, 3, 186, 71, 213, 236, 142, 66, 33, 196, 150, 216, 138, 114 },
D = new byte[] { 94, 20, 94, 119, 18, 92, 141, 13, 17, 238, 92, 80, 22, 96, 232, 82, 128, 164, 115, 195, 191, 119, 142, 202, 135, 210, 103, 8, 10, 11, 51, 60, 208, 207, 168, 179, 253, 164, 250, 80, 245, 42, 201, 128, 97, 123, 108, 161, 69, 63, 47, 49, 24, 150, 165, 139, 105, 214, 154, 104, 172, 159, 86, 208, 64, 134, 158, 156, 234, 125, 140, 210, 3, 32, 60, 28, 62, 154, 198, 21, 132, 191, 236, 10, 158, 12, 247, 159, 177, 77, 178, 53, 238, 95, 165, 9, 200, 28, 148, 242, 35, 70, 189, 121, 169, 248, 97, 91, 111, 45, 103, 1, 167, 220, 67, 250, 175, 89, 122, 238, 192, 144, 142, 248, 198, 101, 96, 129 },
};
I
A (very good) friend of did take a look.
And did say: “didn’t you forget to import the ResourceServerEncryptionPublicKey in the CreateAccesstoken?”
By creating a minimal working example, I did comment out a little too much.
The problem is solved, with adding the following line in the CreateAccessToken function:
accessToken.ResourceServerEncryptionKey.ImportParameters(ResourceServerEncryptionPublicKey);

Why is the elasticsearch index not updating in my mongo rails app?

I'm using the tire gem in my rails 3.2 mongo app and I am having issues with elasticsearch not updating. I included my question model below.
class Question
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Paranoia
field :question, :type => String
field :answer, :type => Array
field :tags, :type => Array
field :views, :type => Integer, :default => 0
include Tire::Model::Search
include Tire::Model::Callbacks
mapping do
indexes :question, :analyzer => 'snowball', :boost => 100
indexes :tags, :analyzer => 'keyword'
end
end
I create new questions by running Question.create(:question => "What day is it?", :answer => "Monday") and it does not come when I search Question.tire.search( "What day is it?" ). Older questions are showing up, but none of the new ones seem to be adding to the index.
Update
The following error message is showing in the log:
[2012-05-14 19:42:41,725][DEBUG][action.index ] [Century, Turner] [questions][4], node[JKD6HjRKQuqgwuQyJTl1qA], [P], s[STARTED]:
Failed to execute [index {[questions][question][4fb1a677e0f5754d2e000004], source[_id=4fb1a677e0f5754d2e000004&answer[]=Monday&created_at=2012-05-14%2019%3A42%3A31%20-0500&deleted_at=&question=What%20day%20is%20it%3F&tags=&updated_at=2012-05-14%2019%3A42%3A31%20-0500&views=0]}]
org.elasticsearch.ElasticSearchParseException: Failed to derive xcontent from (offset=0, length=193): [95, 105, 100, 61, 52, 102, 98, 49, 97, 54, 55, 55, 101, 48, 102, 53, 55, 53, 52, 100, 50, 101, 48, 48, 48, 48, 48, 52, 38, 97, 110, 115, 119, 101, 114, 91, 93, 61, 77, 111, 110, 100, 97, 121, 38, 99, 114, 101, 97, 116, 101, 100, 95, 97, 116, 61, 50, 48, 49, 50, 45, 48, 53, 45, 49, 52, 37, 50, 48, 49, 57, 37, 51, 65, 52, 50, 37, 51, 65, 51, 49, 37, 50, 48, 45, 48, 53, 48, 48, 38, 100, 101, 108, 101, 116, 101, 100, 95, 97, 116, 61, 38, 113, 117, 101, 115, 116, 105, 111, 110, 61, 87, 104, 97, 116, 37, 50, 48, 100, 97, 121, 37, 50, 48, 105, 115, 37, 50, 48, 105, 116, 37, 51, 70, 38, 116, 97, 103, 115, 61, 38, 117, 112, 100, 97, 116, 101, 100, 95, 97, 116, 61, 50, 48, 49, 50, 45, 48, 53, 45, 49, 52, 37, 50, 48, 49, 57, 37, 51, 65, 52, 50, 37, 51, 65, 51, 49, 37, 50, 48, 45, 48, 53, 48, 48, 38, 118, 105, 101, 119, 115, 61, 48]
at org.elasticsearch.common.xcontent.XContentFactory.xContent(XContentFactory.java:147)
at org.elasticsearch.common.xcontent.XContentHelper.createParser(XContentHelper.java:49)
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:431)
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:417)
at org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:311)
at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:202)
at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:529)
at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:427)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Did you provide a compatible implementation of to_indexed_json as outlined in Tire's Readme?
class Article
include Mongoid::Document
field :title, :type => String
field :content, :type => String
include Tire::Model::Search
include Tire::Model::Callbacks
# These Mongo guys sure do get funky with their IDs in +serializable_hash+, let's fix it.
#
def to_indexed_json
self.to_json
end
end

What is the equivalent of this operationContext.IncomingMessageHeaders.Action in ASP.net MVC

I am working on a OAuth 2.0 server and client implementation. I am using "http://www.dotnetopenauth.net/" CTP version. In one of the samples, the code is creating a class inheriting from "ServiceAuthorizationManager" in that they are overwriting method "CheckAccessCore" in the method they are using operationContext.IncomingMessageHeaders.Action to verify the scope of the call. I think this information comes in SOAP message. Now, I want to create an ASP.net MVC resource server, In that I wrote a Authorize attribute. But, I am not able to figure out a replacement of "operationContext.IncomingMessageHeaders.Action". Following is the code of my "OAuthAuthorizedAttribute"
public class OAuthAuthorizedAttribute : ActionFilterAttribute, IAuthorizationFilter
{
public void OnAuthorization(AuthorizationContext filterContext) {
//First verify the access code
var principal = VerifyOAuth2(HttpContext.Current.Request);
//second check the role
if (principal == null)
throw new ApplicationException("Access Token Invalid");
if (!principal.IsInRole(filterContext.HttpContext.Request.Headers.ToString()))
throw new ApplicationException("User doesn't have permission");
}
private IPrincipal VerifyOAuth2(HttpRequest httpRequest) {
// for this sample where the auth server and resource server are the same site,
// we use the same public/private key.
using (var signing = this.CreateAuthorizationServerSigningServiceProvider()) {
using (var encrypting = this.CreateResourceServerEncryptionServiceProvider()) {
var resourceServer = new ResourceServer(new StandardAccessTokenAnalyzer(signing, encrypting));
IPrincipal result;
var error = resourceServer.VerifyAccess(new HttpRequestInfo(httpRequest), out result);
// TODO: return the prepared error code.
return error != null ? null : result;
}
}
}
//#if SAMPLESONLY
/// <summary>
/// The FOR SAMPLE ONLY hard-coded public key of the authorization server that is used to verify the signature on access tokens.
/// </summary>
/// <remarks>
/// In a real app, the authorization server public key would likely come from the server's HTTPS certificate,
/// but in any case would be determined by the authorization server and its policies.
/// The hard-coded value used here is so this sample works well with the OAuthAuthorizationServer sample,
/// which has the corresponding sample private key.
/// </remarks>
public readonly RSAParameters AuthorizationServerSigningPublicKey = new RSAParameters {
Exponent = new byte[] { 1, 0, 1 },
Modulus = new byte[] { 210, 95, 53, 12, 203, 114, 150, 23, 23, 88, 4, 200, 47, 219, 73, 54, 146, 253, 126, 121, 105, 91, 118, 217, 182, 167, 140, 6, 67, 112, 97, 183, 66, 112, 245, 103, 136, 222, 205, 28, 196, 45, 6, 223, 192, 76, 56, 180, 90, 120, 144, 19, 31, 193, 37, 129, 186, 214, 36, 53, 204, 53, 108, 133, 112, 17, 133, 244, 3, 12, 230, 29, 243, 51, 79, 253, 10, 111, 185, 23, 74, 230, 99, 94, 78, 49, 209, 39, 95, 213, 248, 212, 22, 4, 222, 145, 77, 190, 136, 230, 134, 70, 228, 241, 194, 216, 163, 234, 52, 1, 64, 181, 139, 128, 90, 255, 214, 60, 168, 233, 254, 110, 31, 102, 58, 67, 201, 33 },
};
//#else
// [Obsolete("You must use a real key for a real app.", true)]
// public static readonly RSAParameters AuthorizationServerSigningPublicKey = new RSAParameters();
//#endif
//#if SAMPLESONLY
/// <summary>
/// The FOR SAMPLE ONLY hard-coded private key used to decrypt access tokens intended for this resource server.
/// </summary>
/// <remarks>
/// In a real app, the resource server would likely use its own HTTPS certificate or some other certificate stored securely
/// on the server rather than hard-coded in compiled code for security and ease of changing the certificate in case it was compromised.
/// </remarks>
internal readonly RSAParameters ResourceServerEncryptionPrivateKey = new RSAParameters {
Exponent = new byte[] { 1, 0, 1 },
Modulus = new byte[] { 166, 175, 117, 169, 211, 251, 45, 215, 55, 53, 202, 65, 153, 155, 92, 219, 235, 243, 61, 170, 101, 250, 221, 214, 239, 175, 238, 175, 239, 20, 144, 72, 227, 221, 4, 219, 32, 225, 101, 96, 18, 33, 117, 176, 110, 123, 109, 23, 29, 85, 93, 50, 129, 163, 113, 57, 122, 212, 141, 145, 17, 31, 67, 165, 181, 91, 117, 23, 138, 251, 198, 132, 188, 213, 10, 157, 116, 229, 48, 168, 8, 127, 28, 156, 239, 124, 117, 36, 232, 100, 222, 23, 52, 186, 239, 5, 63, 207, 185, 16, 137, 73, 137, 147, 252, 71, 9, 239, 113, 27, 88, 255, 91, 56, 192, 142, 210, 21, 34, 81, 204, 239, 57, 60, 140, 249, 15, 101 },
P = new byte[] { 227, 25, 96, 71, 220, 99, 11, 55, 15, 241, 153, 20, 32, 213, 68, 127, 246, 162, 153, 204, 98, 26, 10, 99, 46, 189, 35, 18, 162, 180, 184, 134, 230, 198, 156, 87, 52, 174, 74, 155, 163, 204, 252, 51, 232, 189, 135, 172, 88, 24, 52, 174, 72, 157, 81, 90, 118, 59, 142, 154, 152, 201, 62, 177 },
Q = new byte[] { 187, 229, 223, 233, 118, 20, 5, 251, 85, 8, 196, 3, 220, 232, 38, 159, 15, 95, 174, 162, 36, 13, 138, 239, 16, 85, 220, 104, 4, 162, 174, 160, 234, 133, 156, 33, 117, 139, 22, 112, 108, 214, 97, 178, 100, 191, 13, 177, 164, 30, 124, 48, 33, 118, 21, 137, 38, 59, 191, 13, 183, 5, 16, 245 },
DP = new byte[] { 225, 112, 117, 117, 160, 191, 233, 136, 53, 153, 158, 94, 174, 225, 71, 104, 200, 75, 77, 229, 232, 148, 245, 46, 212, 93, 9, 142, 28, 90, 206, 187, 140, 40, 41, 87, 32, 130, 204, 169, 136, 135, 154, 237, 100, 227, 144, 229, 115, 102, 68, 21, 167, 28, 20, 128, 122, 210, 80, 148, 3, 139, 243, 97 },
DQ = new byte[] { 133, 252, 100, 207, 232, 184, 92, 143, 157, 82, 115, 220, 65, 81, 118, 0, 228, 136, 153, 81, 219, 157, 160, 157, 218, 171, 47, 81, 41, 69, 12, 123, 136, 224, 159, 182, 40, 72, 119, 70, 210, 5, 137, 131, 25, 94, 55, 152, 157, 236, 115, 40, 43, 36, 54, 53, 39, 131, 97, 56, 153, 114, 206, 101 },
InverseQ = new byte[] { 129, 119, 84, 118, 29, 35, 194, 186, 96, 169, 7, 7, 200, 22, 187, 34, 72, 131, 200, 246, 79, 120, 49, 242, 8, 220, 74, 114, 195, 95, 90, 108, 80, 2, 212, 71, 125, 100, 184, 77, 203, 236, 64, 122, 108, 212, 150, 129, 66, 248, 218, 3, 186, 71, 213, 236, 142, 66, 33, 196, 150, 216, 138, 114 },
D = new byte[] { 94, 20, 94, 119, 18, 92, 141, 13, 17, 238, 92, 80, 22, 96, 232, 82, 128, 164, 115, 195, 191, 119, 142, 202, 135, 210, 103, 8, 10, 11, 51, 60, 208, 207, 168, 179, 253, 164, 250, 80, 245, 42, 201, 128, 97, 123, 108, 161, 69, 63, 47, 49, 24, 150, 165, 139, 105, 214, 154, 104, 172, 159, 86, 208, 64, 134, 158, 156, 234, 125, 140, 210, 3, 32, 60, 28, 62, 154, 198, 21, 132, 191, 236, 10, 158, 12, 247, 159, 177, 77, 178, 53, 238, 95, 165, 9, 200, 28, 148, 242, 35, 70, 189, 121, 169, 248, 97, 91, 111, 45, 103, 1, 167, 220, 67, 250, 175, 89, 122, 238, 192, 144, 142, 248, 198, 101, 96, 129 },
};
//#else
//[Obsolete("You must use a real key for a real app.", true)]
//internal static readonly RSAParameters ResourceServerEncryptionPrivateKey = new RSAParameters();
//#endif
/// <summary>
/// Creates the crypto service provider for this resource server that contains the private key used to decrypt an access token.
/// </summary>
/// <returns>An RSA crypto service provider.</returns>
internal RSACryptoServiceProvider CreateResourceServerEncryptionServiceProvider() {
var resourceServerEncryptionServiceProvider = new RSACryptoServiceProvider();
resourceServerEncryptionServiceProvider.ImportParameters(ResourceServerEncryptionPrivateKey);
return resourceServerEncryptionServiceProvider;
}
/// <summary>
/// Creates the crypto service provider for the authorization server that contains the public key used to verify an access token signature.
/// </summary>
/// <returns>An RSA crypto service provider.</returns>
internal RSACryptoServiceProvider CreateAuthorizationServerSigningServiceProvider() {
var authorizationServerSigningServiceProvider = new RSACryptoServiceProvider();
authorizationServerSigningServiceProvider.ImportParameters(AuthorizationServerSigningPublicKey);
return authorizationServerSigningServiceProvider;
}
}
Action is related only to SOAP message processing - it identifies operation to be executed to process incoming SOAP request. Equivalent in MVC is routing mechanism which maps requested URL to actions in controllers. When implementing ActionFilter you already have these data available. All virtual methods defined in ActionFilterAttribute base class accepts ActionExecutedContext which has ActionDescriptor property - it will give you information about currently evaluated action and controller. AuthorizationContext passed to OnAuthorization method also contains ActionDescriptor property.

Resources